get-browser-fingerprint 3.1.0 → 3.2.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/README.md CHANGED
@@ -13,7 +13,8 @@ console.log(fingerprint);
13
13
 
14
14
  Options available:
15
15
  - `hardwareOnly` (default `false`): leverage only hardware info about device
16
- - `enableWebgl` (default `false`): enable webgl renderer, ~4x times slower but adds another deadly powerful hardware detection layer on top of canvas
16
+ - `enableWebgl` (default `false`): enable webgl renderer, ~4x times slower but adds another deadly powerful hardware detection layer on top of canvas
17
+ - `enableScreen` (default `true`): enable screen resolution detection, disable it if your userbase may use multiple screens
17
18
  - `debug`: log data used to generate fingerprint to console and add canvas/webgl canvas to body to see rendered image (default `false`)
18
19
 
19
20
  ⚠️ Be careful: the strongest discriminating factor is canvas token which can't be computed on old devices (eg: iPhone 6), deal accordingly ⚠️
@@ -30,4 +31,4 @@ yarn test
30
31
  To run example locally:
31
32
  ```sh
32
33
  yarn http-server src -o -c-1 -p 80
33
- ```
34
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-browser-fingerprint",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "author": "Damiano Barbati <damiano.barbati@gmail.com> (https://github.com/damianobarbati)",
5
5
  "repository": "https://github.com/damianobarbati/get-browser-fingerprint",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -1,4 +1,9 @@
1
- const getBrowserFingerprint = ({ hardwareOnly = false, enableWebgl = false, debug = false } = {}) => {
1
+ const getBrowserFingerprint = ({
2
+ hardwareOnly = false,
3
+ enableWebgl = false,
4
+ enableScreen = true,
5
+ debug = false,
6
+ } = {}) => {
2
7
  const {
3
8
  cookieEnabled,
4
9
  deviceMemory,
@@ -12,7 +17,7 @@ const getBrowserFingerprint = ({ hardwareOnly = false, enableWebgl = false, debu
12
17
  vendor,
13
18
  } = window.navigator;
14
19
 
15
- const { width, height, colorDepth, pixelDepth } = window.screen;
20
+ const { width, height, colorDepth, pixelDepth } = enableScreen ? window.screen : {}; // undefined will remove this from the stringify down here
16
21
  const timezoneOffset = new Date().getTimezoneOffset();
17
22
  const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
18
23
  const touchSupport = 'ontouchstart' in window;