forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fingerprint.d.ts
99 lines (81 loc) · 2.22 KB
/
fingerprint.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Type definitions for fingerprintjs 0.5.4
// Project: https://github.com/Valve/fingerprintjs
// Definitions by: Shunsuke Ohtani <https://github.com/zaneli>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module FingerprintJs {
interface FingerprintStatic {
/**
* Create Fingerprint object.
*/
new(hasher: (key: string, seed: number) => number): Fingerprint;
new(option: FingerprintOption): Fingerprint;
new(): Fingerprint;
}
interface Fingerprint {
/**
* Generate fingerprint number.
*/
get(): number;
/**
* Generate fingerprint number using Murmur hashing.
* @param key ASCII only
* @param seed Positive integer only
*/
murmurhash3_32_gc(key: string, seed: number): number;
/**
* Check whether or not the browser has local storage.
*/
hasLocalStorage(): boolean;
/**
* Check whether or not the browser has session storage.
*/
hasSessionStorage(): boolean;
/**
* Check whether or not the browser supports canvas.
*/
isCanvasSupported(): boolean;
/**
* Check whether or not the browser is IE.
*/
isIE(): boolean;
/**
* Get plugins string.
*/
getPluginsString(): string;
/**
* Get plugins string from navigator plugins.
*/
getRegularPluginsString(): string;
/**
* Get plugins string from ActiveXObject.
*/
getIEPluginsString(): string;
/**
* Get screen height and width.
*/
getScreenResolution(): number[];
/**
* Get canvas data url string.
*/
getCanvasFingerprint(): string;
}
interface FingerprintOption {
/**
* If you want to use canvas fingerprinting, set true.
*/
canvas?: boolean;
/**
* If you want to use the screen resolution in calculating the fingerprint, set true.
*/
screen_resolution?: boolean;
/**
* If you want to query the IE plugins info to further diversify the fingerprinting process, set true.
*/
ie_activex?: boolean;
/**
* If you want to use custom hashing function, set function.
*/
hasher?: (key: string, seed: number) => number;
}
}
declare var Fingerprint: FingerprintJs.FingerprintStatic;