-
Notifications
You must be signed in to change notification settings - Fork 1
/
global.ts
46 lines (38 loc) · 1.24 KB
/
global.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
import * as FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
import { ICache } from './cache'
export type VisitorData<TExtended extends boolean = false> = TExtended extends false
? FingerprintJS.GetResult
: FingerprintJS.ExtendedGetResult
export type FpjsSpaResponse<T> = T & {
// Indicates whether the response was retrieved from cache.
cacheHit: boolean
}
export enum CacheLocation {
Memory = 'memory',
LocalStorage = 'localstorage',
SessionStorage = 'sessionstorage',
NoCache = 'nocache',
}
export interface FpjsClientOptions {
/**
* Options for the FingerprintJS JS Agent load() method.
*/
loadOptions: FingerprintJS.LoadOptions
/**
* Defines which built-in cache mechanism the client should use.
*/
cacheLocation?: CacheLocation
/**
* Custom cache implementation. Takes precedence over the `cacheLocation` property.
*/
cache?: ICache
/**
* Duration in seconds for which data is stored in cache. Cannot exceed 86_400 (24h) because caching data
* for longer than 24 hours can negatively affect identification accuracy.
*/
cacheTimeInSeconds?: number
/**
* Custom prefix for localStorage and sessionStorage cache keys. Will be ignored if `cache` is provided.
*/
cachePrefix?: string
}