Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 }
})
}
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)
}
}