get-browser-fingerprint
Advanced tools
Comparing version 3.2.0 to 3.2.2
{ | ||
"name": "get-browser-fingerprint", | ||
"version": "3.2.0", | ||
"version": "3.2.2", | ||
"author": "Damiano Barbati <damiano.barbati@gmail.com> (https://github.com/damianobarbati)", | ||
@@ -8,18 +8,20 @@ "repository": "https://github.com/damianobarbati/get-browser-fingerprint", | ||
"main": "src/index.js", | ||
"type": "module", | ||
"files": [ | ||
"README.md", | ||
"package.json", | ||
"src/index.js" | ||
"src/index.js", | ||
"src/index.d.js" | ||
], | ||
"type": "module", | ||
"types": "./src/index.d.ts", | ||
"scripts": { | ||
"eslint": "eslint --ignore-path .gitignore --fix", | ||
"lint": "biome check --write", | ||
"test": "vitest run" | ||
}, | ||
"devDependencies": { | ||
"eslint-config-xs": "^2.6.1", | ||
"http-server": "^14.1.1", | ||
"puppeteer": "^21.4.1", | ||
"vitest": "^0.34.6" | ||
"@biomejs/biome": "^1.8.3", | ||
"@playwright/test": "^1.47.0", | ||
"serve": "^14.2.3", | ||
"vitest": "^2.0.5" | ||
} | ||
} |
@@ -33,3 +33,3 @@ # get-browser-fingerprint | ||
```sh | ||
yarn http-server src -o -c-1 -p 80 | ||
pnpm serve -p 80 ./src | ||
``` |
@@ -1,19 +0,3 @@ | ||
const getBrowserFingerprint = ({ | ||
hardwareOnly = false, | ||
enableWebgl = false, | ||
enableScreen = true, | ||
debug = false, | ||
} = {}) => { | ||
const { | ||
cookieEnabled, | ||
deviceMemory, | ||
doNotTrack, | ||
hardwareConcurrency, | ||
language, | ||
languages, | ||
maxTouchPoints, | ||
platform, | ||
userAgent, | ||
vendor, | ||
} = window.navigator; | ||
const getBrowserFingerprint = ({ hardwareOnly = false, enableWebgl = false, enableScreen = true, debug = false } = {}) => { | ||
const { cookieEnabled, deviceMemory, doNotTrack, hardwareConcurrency, language, languages, maxTouchPoints, platform, userAgent, vendor } = window.navigator; | ||
@@ -23,3 +7,3 @@ const { width, height, colorDepth, pixelDepth } = enableScreen ? window.screen : {}; // undefined will remove this from the stringify down here | ||
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
const touchSupport = 'ontouchstart' in window; | ||
const touchSupport = "ontouchstart" in window; | ||
const devicePixelRatio = window.devicePixelRatio; | ||
@@ -73,3 +57,3 @@ | ||
if (debug) console.log('fingerprint data', datastring); | ||
if (debug) console.log("fingerprint data", datastring); | ||
@@ -82,13 +66,13 @@ const result = murmurhash3_32_gc(datastring); | ||
try { | ||
const canvas = document.createElement('canvas'); | ||
const ctx = canvas.getContext('2d'); | ||
const canvas = document.createElement("canvas"); | ||
const ctx = canvas.getContext("2d"); | ||
const text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~1!2@3#4$5%6^7&8*9(0)-_=+[{]}|;:',<.>/?"; | ||
ctx.textBaseline = 'top'; | ||
ctx.textBaseline = "top"; | ||
ctx.font = "14px 'Arial'"; | ||
ctx.textBaseline = 'alphabetic'; | ||
ctx.fillStyle = '#f60'; | ||
ctx.textBaseline = "alphabetic"; | ||
ctx.fillStyle = "#f60"; | ||
ctx.fillRect(125, 1, 62, 20); | ||
ctx.fillStyle = '#069'; | ||
ctx.fillStyle = "#069"; | ||
ctx.fillText(text, 2, 15); | ||
ctx.fillStyle = 'rgba(102, 204, 0, 0.7)'; | ||
ctx.fillStyle = "rgba(102, 204, 0, 0.7)"; | ||
ctx.fillText(text, 4, 17); | ||
@@ -112,4 +96,4 @@ | ||
try { | ||
const canvas = document.createElement('canvas'); | ||
const ctx = canvas.getContext('webgl'); | ||
const canvas = document.createElement("canvas"); | ||
const ctx = canvas.getContext("webgl"); | ||
canvas.width = 256; | ||
@@ -119,5 +103,4 @@ canvas.height = 128; | ||
const f = | ||
'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}'; | ||
const g = | ||
'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}'; | ||
"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"; | ||
const g = "precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"; | ||
const h = ctx.createBuffer(); | ||
@@ -129,3 +112,5 @@ | ||
ctx.bufferData(ctx.ARRAY_BUFFER, i, ctx.STATIC_DRAW), (h.itemSize = 3), (h.numItems = 3); | ||
ctx.bufferData(ctx.ARRAY_BUFFER, i, ctx.STATIC_DRAW); | ||
h.itemSize = 3; | ||
h.numItems = 3; | ||
@@ -147,4 +132,4 @@ const j = ctx.createProgram(); | ||
j.vertexPosAttrib = ctx.getAttribLocation(j, 'attrVertex'); | ||
j.offsetUniform = ctx.getUniformLocation(j, 'uniformOffset'); | ||
j.vertexPosAttrib = ctx.getAttribLocation(j, "attrVertex"); | ||
j.offsetUniform = ctx.getUniformLocation(j, "uniformOffset"); | ||
@@ -159,3 +144,3 @@ ctx.enableVertexAttribArray(j.vertexPosArray); | ||
const result = JSON.stringify(n).replace(/,?"[0-9]+":/g, ''); | ||
const result = JSON.stringify(n).replace(/,?"[0-9]+":/g, ""); | ||
@@ -176,3 +161,3 @@ if (debug) { | ||
try { | ||
const ctx = document.createElement('canvas').getContext('webgl'); | ||
const ctx = document.createElement("canvas").getContext("webgl"); | ||
@@ -198,10 +183,8 @@ const result = { | ||
let h1, h1b, k1; | ||
let h1; | ||
let h1b; | ||
let k1; | ||
for (let i = 0; i < bytes; i++) { | ||
k1 = | ||
(key.charCodeAt(i) & 0xff) | | ||
((key.charCodeAt(++i) & 0xff) << 8) | | ||
((key.charCodeAt(++i) & 0xff) << 16) | | ||
((key.charCodeAt(++i) & 0xff) << 24); | ||
k1 = (key.charCodeAt(i) & 0xff) | ((key.charCodeAt(++i) & 0xff) << 8) | ((key.charCodeAt(++i) & 0xff) << 16) | ((key.charCodeAt(++i) & 0xff) << 24); | ||
++i; | ||
@@ -254,3 +237,3 @@ | ||
if (typeof window !== 'undefined') { | ||
if (typeof window !== "undefined") { | ||
window.getBrowserFingerprint = getBrowserFingerprint; | ||
@@ -257,0 +240,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8715
189