@thumbmarkjs/thumbmarkjs 0.14.1 → 0.14.2

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
@@ -6,7 +6,7 @@ ThumbmarkJS is the world's second best browser fingerprinting JavaScript library
6
6
 
7
7
  ThumbmarkJS is open source (MIT).
8
8
 
9
- 🙏 Please don't do evil. ThumbmarkJS is meant to be used for good. We use this at work to prevent scammers and spammers.
9
+ 🙏 Please don't do evil. ThumbmarkJS is meant to be used for good. Use this to prevent scammers and spammers for example. If you see this library being used for evil, contact me.
10
10
 
11
11
  ## Demo page
12
12
 
@@ -26,7 +26,7 @@ Supported module formats:
26
26
  ### And on the web page:
27
27
 
28
28
  ```javascript
29
- <script src="https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.iife.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.umd.js"></script>
30
30
  <script>
31
31
  ThumbmarkJS.getFingerprint().then(
32
32
  function(fp) {
@@ -38,7 +38,7 @@ ThumbmarkJS.getFingerprint().then(
38
38
  <!-- or -->
39
39
 
40
40
  <script>
41
- import('https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.iife.js')
41
+ import('https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.umd.js')
42
42
  .then(() => {
43
43
  ThumbmarkJS.getFingerprint().then((fp) => { console.log(fp)})
44
44
  })
@@ -50,6 +50,19 @@ You can also call `ThumbmarkJS.getFingerprintData()` to get a full JSON object w
50
50
  You can also get any previous version from the CDN by replacing `latest` with the version number. Currently the URL would be
51
51
  `https://cdn.thumbmarkjs.com/0.13.0/Thumbmark.js`
52
52
 
53
+ ## Options
54
+
55
+ You can use the `setOption` method to change the behavior of the library. Currently it takes only one option.
56
+
57
+ | option | type | example | what it does |
58
+ | - | - | - | - |
59
+ | exclude | string[] | ['webgl', 'system.browser.version'] | removes components from the fingerprint hash. An excluded top-level component improves performance. |
60
+
61
+ example usage:
62
+
63
+ ```
64
+ ThumbmarkJS.setOption('exclude', ['webgl', 'system.browser.version])
65
+ ```
53
66
 
54
67
  ## Install with NPM
55
68
 
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file is used to create the includeComponent function as well as the interfaces each of the
3
+ * fingerprint components must implement.
4
+ *
5
+ */
6
+ interface componentInterface {
7
+ [key: string]: string | string[] | number | boolean | componentInterface;
8
+ }
9
+
10
+ declare function getFingerprintData(): Promise<componentInterface>;
11
+ declare function getFingerprint(): Promise<string>;
12
+ declare function getFingerprintPerformance(): Promise<{
13
+ [key: string]: any;
14
+ }>;
15
+
16
+ interface optionsInterface {
17
+ exclude?: string[];
18
+ include?: string[];
19
+ webgl_runs?: number;
20
+ canvas_runs?: number;
21
+ }
22
+ declare function setOption<K extends keyof optionsInterface>(key: K, value: optionsInterface[K]): void;
23
+
24
+ declare function getVersion(): string;
25
+
26
+ export { getFingerprint, getFingerprintData, getFingerprintPerformance, getVersion, setOption };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@thumbmarkjs/thumbmarkjs",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "",
5
- "main": "dist/thumbmark.cjs.js",
6
- "module": "dist/thumbmark.esm.js",
7
- "types": "dist/types/index.d.ts",
5
+ "main": "./dist/thumbmark.cjs.js",
6
+ "module": "./dist/thumbmark.esm.js",
7
+ "types": "./dist/types/thumbmark.esm.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/thumbmark.esm.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "test": "jest",
20
- "build": "rm -rf dist/* && rollup -c"
20
+ "build": "rm -rf dist/* && rm -rf types/* && rollup -c"
21
21
  },
22
22
  "keywords": [
23
23
  "fingerprint",
@@ -33,12 +33,12 @@
33
33
  "license": "MIT",
34
34
  "unpkg": "dist/thumbmark.umd.js",
35
35
  "devDependencies": {
36
- "@testing-library/jest-dom": "^6.1.6",
37
36
  "@rollup/plugin-commonjs": "^25.0.7",
38
37
  "@rollup/plugin-json": "^6.1.0",
39
38
  "@rollup/plugin-node-resolve": "^15.2.3",
40
39
  "@rollup/plugin-terser": "^0.4.4",
41
40
  "@rollup/plugin-typescript": "^11.1.6",
41
+ "@testing-library/jest-dom": "^6.1.6",
42
42
  "@types/jest": "^29.5.11",
43
43
  "@types/jsdom": "^21.1.6",
44
44
  "@types/node": "^20.10.6",
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function generateCanvasFingerprint(): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getFontMetrics(): Promise<componentInterface>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- /**
2
- * Does anyone have a cleaner way of doing this?
3
- * I want to import all the components in this folder
4
- * Feels a little dumb I'm doing this manually.
5
- */
6
- import './audio/audio';
7
- import './canvas/canvas';
8
- import './fonts/fonts';
9
- import './hardware/hardware';
10
- import './locales/locales';
11
- import './permissions/permissions';
12
- import './plugins/plugins';
13
- import './screen/screen';
14
- import './system/system';
15
- import './webgl/webgl';
16
- import './math/math';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getBrowserPermissions(): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getInstalledPlugins(): Promise<componentInterface>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- interface BrowserResult {
2
- name: string;
3
- version: string;
4
- }
5
- export declare function getBrowser(): BrowserResult;
6
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * This file is used to create the includeComponent function as well as the interfaces each of the
3
- * fingerprint components must implement.
4
- *
5
- */
6
- export interface componentInterface {
7
- [key: string]: string | string[] | number | boolean | componentInterface;
8
- }
9
- export interface componentFunctionInterface {
10
- (): Promise<componentInterface>;
11
- }
12
- export declare const components: {
13
- [name: string]: componentFunctionInterface;
14
- };
15
- export declare const timeoutInstance: componentInterface;
16
- /**
17
- * includeComponent is the function each component function needs to call in order for the component to be included
18
- * in the fingerprint.
19
- * @param {string} name - the name identifier of the component
20
- * @param {componentFunctionInterface} creationFunction - the function that implements the component
21
- * @returns
22
- */
23
- export declare const includeComponent: (name: string, creationFunction: componentFunctionInterface) => void;
24
- /**
25
- * The function turns the map of component functions to a map of Promises when called
26
- * @returns {[name: string]: <Promise>componentInterface}
27
- */
28
- export declare const getComponentPromises: () => {
29
- [k: string]: Promise<componentInterface>;
30
- };
@@ -1,6 +0,0 @@
1
- import { componentInterface } from '../factory';
2
- export declare function getFingerprintData(): Promise<componentInterface>;
3
- export declare function getFingerprint(): Promise<string>;
4
- export declare function getFingerprintPerformance(): Promise<{
5
- [key: string]: any;
6
- }>;
@@ -1,8 +0,0 @@
1
- export interface optionsInterface {
2
- exclude?: string[];
3
- include?: string[];
4
- webgl_runs?: number;
5
- canvas_runs?: number;
6
- }
7
- export declare let options: optionsInterface;
8
- export declare function setOption<K extends keyof optionsInterface>(key: K, value: optionsInterface[K]): void;
@@ -1,5 +0,0 @@
1
- import { getFingerprint, getFingerprintData, getFingerprintPerformance } from './fingerprint/functions';
2
- import { setOption } from './fingerprint/options';
3
- import './components';
4
- declare function getVersion(): string;
5
- export { setOption, getVersion, getFingerprint, getFingerprintData, getFingerprintPerformance };
@@ -1 +0,0 @@
1
- export declare function getCommonPixels(images: ImageData[], width: number, height: number): ImageData;
@@ -1,4 +0,0 @@
1
- export declare function ephemeralIFrame(callback: ({ iframe }: {
2
- iframe: Document;
3
- }) => void): Promise<any>;
4
- export declare function wait<T = void>(durationMs: number, resolveWith?: T): Promise<T>;
@@ -1,5 +0,0 @@
1
- export declare function mostFrequentValuesInArrayOfDictionaries(arr: {
2
- [key: string]: any;
3
- }[], keys: string[]): {
4
- [key: string]: any;
5
- };
@@ -1 +0,0 @@
1
- export declare function hash(key: string, seed?: number): string;
@@ -1 +0,0 @@
1
- export declare function imageDataToDataURL(imageData: ImageData): string;
@@ -1,9 +0,0 @@
1
- type DelayedPromise<T> = Promise<T>;
2
- export declare function delay<T>(t: number, val: T): DelayedPromise<T>;
3
- export interface RaceResult<T> {
4
- value: T;
5
- elapsed?: number;
6
- }
7
- export declare function raceAllPerformance<T>(promises: Promise<T>[], timeoutTime: number, timeoutVal: T): Promise<RaceResult<T>[]>;
8
- export declare function raceAll<T>(promises: Promise<T>[], timeoutTime: number, timeoutVal: T): Promise<(T | undefined)[]>;
9
- export {};