How to use fingerprintjs2 - 10 common examples

To help you get started, we’ve selected a few fingerprintjs2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github justiceo / WebChat / src / app / authenticate / authenticate.js View on Github external
init(socket) {
        this.socket = socket;
        this.registerListeners();
        new Fingerprint2().get((deviceFingerPrint, components) => {
            this.state = 'loadedQRCode';
            this.cache("deviceId", deviceFingerPrint);
            // using volatile means the connection doesn't have to succeed
            // to prevent spamming the server with stale requests on-resume
            // problem is how do we then resume?
            this.trigger(EVENTS.TOKEN_REQUEST, deviceFingerPrint);
        })

    }
github catogonzalez / universal-chat-widget / src / main.js View on Github external
var _adapterConfig = config.adapterConfig

  // retrieve device fingerprint from (browser) local storage
  var _deviceId = localStorage.getItem('ucwDeviceId')

  if (_deviceId === null || _deviceId === undefined) {
    // check if config data provides a user.id
    if (_adapterConfig && _adapterConfig.initData && _adapterConfig.initData.data && _adapterConfig.initData.data.user && _adapterConfig.initData.data.user.id) {
      // TODO: implement user-merge in backend, when user.id is provided and localStorage.devideId id already set, user.id should survive the merge
      _deviceId = _adapterConfig.initData.data.user.id
      localStorage.setItem('ucwDeviceId', _deviceId)
      initAdapter()
    } else {
      // register new device:
      // build deviceId from Fingerprint2
      new Fingerprint2().get(function (result) {
        _deviceId = result
        localStorage.setItem('ucwDeviceId', _deviceId)
        initAdapter()
      })
    }
  } else {
    initAdapter()
  }

  function isFalsey (value) {
    return (value === 'false' || value === false || value === 0 || value === '0')
  }

  function initAdapter () {
    // Let's init the communication with the backend
github OriginProtocol / origin / dapps / marketplace / src / hoc / withFingerprint.js View on Github external
function fetchFingerprint() {
  return Fingerprint2.getPromise({}).then(components => {
    const values = components.map(component => component.value)
    const hash = `V1-${Fingerprint2.x64hash128(values.join(''), 31)}`

    // Select the browser properties to export along with the fingerprint.
    const browserProps = {}
    components
      .filter(x => browserPropsWhitelist.includes(x.key))
      .forEach(x => (browserProps[x.key] = x.value))
    cachedFingerprintData = { fingerprint: hash, ...browserProps }
  })
}
github OriginProtocol / origin / dapps / marketplace / src / hoc / withFingerprint.js View on Github external
return Fingerprint2.getPromise({}).then(components => {
    const values = components.map(component => component.value)
    const hash = `V1-${Fingerprint2.x64hash128(values.join(''), 31)}`

    // Select the browser properties to export along with the fingerprint.
    const browserProps = {}
    components
      .filter(x => browserPropsWhitelist.includes(x.key))
      .forEach(x => (browserProps[x.key] = x.value))
    cachedFingerprintData = { fingerprint: hash, ...browserProps }
  })
}
github blinktrade / BlinkTradeJS / src / transports / websocket.js View on Github external
getFingerPrint(customFingerprint?: string): void {
    if (IS_NODE) {
      return getMac(macAddress => {
        this.fingerPrint = macAddress;
      });
    } else if (IS_BROWSER) {
      return new Fingerprint2().get(fingerPrint => {
        this.fingerPrint = Math.abs(encodeByteArray(fingerPrint)).toString();
      });
    } else if (customFingerprint) {
      this.fingerPrint = customFingerprint;
    } else {
      throw new Error('FingerPrint not provided');
    }
  }
github roblav96 / robinhood.tools / src / client / adapters / security.ts View on Github external
return doc.finger ? doc.finger : new Promise(function(resolve) {
			new Fingerprint2().get(resolve)
		})
github yannbf / may-the-4th / src / app / app.component.ts View on Github external
this.storage.get('uuid').then(uuid => {
        if(uuid){
          this.global.set('uuid', uuid);
        } else {
          new Fingerprint2().get((result, components) => {
            this.global.set('uuid', result);
            this.storage.set('uuid', result);
          });
        }
      });
      this.global.set('side', 'light');
github go-faast / faast-web / src / utilities / cfp.js View on Github external
async function generate() {
  try {
    const components = await Fp2.getPromise()
    const values = components.map(({ value }) => value)
    cfp = Fp2.x64hash128(values.join(''), 31)
    log.log('generate cfp', cfp)
  } catch (e) {
    log.error('failed to generate cfp', e)
  }
}
github feryandi / PilahPilihPilpres / fe / src / components / Home.js View on Github external
Fingerprint2.get(options, (components) => {
          var values = components.map(function (component) { return component.value });
          var murmur = Fingerprint2.x64hash128(values.join(''), 31);
          nookies.set({}, 'fp', murmur, {
            maxAge: 30 * 24 * 60 * 60,
            path: '/',
          });
          this.getSession(murmur);
      });
    } else {
github go-faast / faast-web / src / utilities / cfp.js View on Github external
async function generate() {
  try {
    const components = await Fp2.getPromise()
    const values = components.map(({ value }) => value)
    cfp = Fp2.x64hash128(values.join(''), 31)
    log.log('generate cfp', cfp)
  } catch (e) {
    log.error('failed to generate cfp', e)
  }
}

fingerprintjs2

Warning! The library is renamed to @fingerprintjs/fingerprintjs. See https://github.com/fingerprintjs/fingerprintjs to get updates.

MIT
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis