@mack1ch/fingerprint-js 0.1.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.
@@ -0,0 +1,89 @@
1
+ type UserDataItem = {
2
+ category: string;
3
+ key: string;
4
+ label: string;
5
+ value: string;
6
+ /** Пояснение: что за метрика и как использовать (для тултипа и CSV). */
7
+ description?: string;
8
+ };
9
+
10
+ type FingerprintMode = 'fast' | 'balanced' | 'accurate';
11
+ type DigestAlgorithm = 'SHA-256' | 'MD5';
12
+ type FingerprintCollectFlags = {
13
+ network: boolean;
14
+ webrtc: boolean;
15
+ permissions: boolean;
16
+ mediaDevices: boolean;
17
+ battery: boolean;
18
+ uaHints: boolean;
19
+ keyboard: boolean;
20
+ adBlock: boolean;
21
+ screenDetails: boolean;
22
+ storageEstimate: boolean;
23
+ };
24
+ type FingerprintPerformanceOptions = {
25
+ mode?: FingerprintMode;
26
+ timeoutMs?: number;
27
+ maxConcurrency?: number;
28
+ cacheTtlMs?: number;
29
+ };
30
+ type FingerprintPrivacyOptions = {
31
+ includeRaw?: boolean;
32
+ maskSensitive?: boolean;
33
+ };
34
+ type FingerprintComponentKind = 'required' | 'optional' | 'device';
35
+ type FingerprintComponent = {
36
+ key: string;
37
+ value: string;
38
+ kind: FingerprintComponentKind;
39
+ required: boolean;
40
+ present: boolean;
41
+ weight: number;
42
+ source: 'input' | 'signal';
43
+ };
44
+ type FingerprintMeta = {
45
+ mode: FingerprintMode;
46
+ digestAlgorithm: DigestAlgorithm;
47
+ startedAt: string;
48
+ completedAt: string;
49
+ elapsedMs: number;
50
+ timedOutCollectors: string[];
51
+ failedCollectors: Array<{
52
+ collector: string;
53
+ reason: string;
54
+ }>;
55
+ cacheHit: boolean;
56
+ confidenceScore: number;
57
+ };
58
+ type FingerprintResult = {
59
+ hash: string;
60
+ hashVersion: 'fp_v1';
61
+ components: FingerprintComponent[];
62
+ requiredInputs: Record<string, string>;
63
+ optionalInputs: Record<string, string>;
64
+ deviceSignals: Record<string, string>;
65
+ raw: UserDataItem[];
66
+ meta: FingerprintMeta;
67
+ };
68
+ type FingerprintOptions = {
69
+ required: Record<string, string | number | boolean | null | undefined>;
70
+ optional?: Record<string, string | number | boolean | null | undefined>;
71
+ collect?: Partial<FingerprintCollectFlags>;
72
+ performance?: FingerprintPerformanceOptions;
73
+ privacy?: FingerprintPrivacyOptions;
74
+ hash?: {
75
+ algorithm?: DigestAlgorithm;
76
+ };
77
+ };
78
+ type FingerprintQuickOptions = {
79
+ required: FingerprintOptions['required'];
80
+ optional?: FingerprintOptions['optional'];
81
+ privacy?: FingerprintPrivacyOptions;
82
+ hash?: FingerprintOptions['hash'];
83
+ };
84
+
85
+ declare function getFingerprint(options: FingerprintOptions): Promise<FingerprintResult>;
86
+ declare function getFingerprintQuick(options: FingerprintQuickOptions): Promise<FingerprintResult>;
87
+ declare function resolveFingerprintPerformance(options?: FingerprintOptions['performance']): Required<FingerprintPerformanceOptions>;
88
+
89
+ export { type DigestAlgorithm, type FingerprintCollectFlags, type FingerprintComponent, type FingerprintMeta, type FingerprintMode, type FingerprintOptions, type FingerprintPerformanceOptions, type FingerprintPrivacyOptions, type FingerprintQuickOptions, type FingerprintResult, getFingerprint, getFingerprintQuick, resolveFingerprintPerformance };
@@ -0,0 +1,89 @@
1
+ type UserDataItem = {
2
+ category: string;
3
+ key: string;
4
+ label: string;
5
+ value: string;
6
+ /** Пояснение: что за метрика и как использовать (для тултипа и CSV). */
7
+ description?: string;
8
+ };
9
+
10
+ type FingerprintMode = 'fast' | 'balanced' | 'accurate';
11
+ type DigestAlgorithm = 'SHA-256' | 'MD5';
12
+ type FingerprintCollectFlags = {
13
+ network: boolean;
14
+ webrtc: boolean;
15
+ permissions: boolean;
16
+ mediaDevices: boolean;
17
+ battery: boolean;
18
+ uaHints: boolean;
19
+ keyboard: boolean;
20
+ adBlock: boolean;
21
+ screenDetails: boolean;
22
+ storageEstimate: boolean;
23
+ };
24
+ type FingerprintPerformanceOptions = {
25
+ mode?: FingerprintMode;
26
+ timeoutMs?: number;
27
+ maxConcurrency?: number;
28
+ cacheTtlMs?: number;
29
+ };
30
+ type FingerprintPrivacyOptions = {
31
+ includeRaw?: boolean;
32
+ maskSensitive?: boolean;
33
+ };
34
+ type FingerprintComponentKind = 'required' | 'optional' | 'device';
35
+ type FingerprintComponent = {
36
+ key: string;
37
+ value: string;
38
+ kind: FingerprintComponentKind;
39
+ required: boolean;
40
+ present: boolean;
41
+ weight: number;
42
+ source: 'input' | 'signal';
43
+ };
44
+ type FingerprintMeta = {
45
+ mode: FingerprintMode;
46
+ digestAlgorithm: DigestAlgorithm;
47
+ startedAt: string;
48
+ completedAt: string;
49
+ elapsedMs: number;
50
+ timedOutCollectors: string[];
51
+ failedCollectors: Array<{
52
+ collector: string;
53
+ reason: string;
54
+ }>;
55
+ cacheHit: boolean;
56
+ confidenceScore: number;
57
+ };
58
+ type FingerprintResult = {
59
+ hash: string;
60
+ hashVersion: 'fp_v1';
61
+ components: FingerprintComponent[];
62
+ requiredInputs: Record<string, string>;
63
+ optionalInputs: Record<string, string>;
64
+ deviceSignals: Record<string, string>;
65
+ raw: UserDataItem[];
66
+ meta: FingerprintMeta;
67
+ };
68
+ type FingerprintOptions = {
69
+ required: Record<string, string | number | boolean | null | undefined>;
70
+ optional?: Record<string, string | number | boolean | null | undefined>;
71
+ collect?: Partial<FingerprintCollectFlags>;
72
+ performance?: FingerprintPerformanceOptions;
73
+ privacy?: FingerprintPrivacyOptions;
74
+ hash?: {
75
+ algorithm?: DigestAlgorithm;
76
+ };
77
+ };
78
+ type FingerprintQuickOptions = {
79
+ required: FingerprintOptions['required'];
80
+ optional?: FingerprintOptions['optional'];
81
+ privacy?: FingerprintPrivacyOptions;
82
+ hash?: FingerprintOptions['hash'];
83
+ };
84
+
85
+ declare function getFingerprint(options: FingerprintOptions): Promise<FingerprintResult>;
86
+ declare function getFingerprintQuick(options: FingerprintQuickOptions): Promise<FingerprintResult>;
87
+ declare function resolveFingerprintPerformance(options?: FingerprintOptions['performance']): Required<FingerprintPerformanceOptions>;
88
+
89
+ export { type DigestAlgorithm, type FingerprintCollectFlags, type FingerprintComponent, type FingerprintMeta, type FingerprintMode, type FingerprintOptions, type FingerprintPerformanceOptions, type FingerprintPrivacyOptions, type FingerprintQuickOptions, type FingerprintResult, getFingerprint, getFingerprintQuick, resolveFingerprintPerformance };