@rebilly/risk-data-collector 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/risk-data-collector",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Microlibrary that collects browser data for risk assessment",
5
5
  "type": "module",
6
6
  "main": "dist/data-collector.js",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.10.1",
30
- "@fingerprintjs/fingerprintjs": "^2.1.0"
30
+ "@fingerprintjs/fingerprintjs": "^3.3.3"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/core": "^7.10.1",
@@ -1,17 +1,17 @@
1
- import Fingerprint2 from '@fingerprintjs/fingerprintjs';
1
+ import FingerprintJS from '@fingerprintjs/fingerprintjs';
2
2
 
3
3
  /**
4
4
  * generateFingerprint is implemented following guidelines
5
5
  * from the @fingerprintjs/fingerprintjs package documentation:
6
- * https://github.com/fingerprintjs/fingerprintjs#get-and-getpromise
6
+ * https://github.com/fingerprintjs/fingerprintjs/blob/master/docs/api.md
7
7
  */
8
8
  async function generateFingerprint() {
9
9
  try {
10
- const components = await Fingerprint2.getPromise();
11
- const values = components.map((comp) => comp.value);
12
- const murmur = Fingerprint2.x64hash128(values.join(''), 31);
10
+ // Turn off FingerprintJS analytics
11
+ const fingerprint = await FingerprintJS.load({ monitoring: false });
12
+ const result = await fingerprint.get();
13
13
 
14
- return murmur;
14
+ return result.visitorId;
15
15
  } catch (e) {
16
16
  // eslint-disable-next-line no-console
17
17
  console.log(e);