/** * Fingerprint v4.1.5 - Copyright (c) FingerprintJS, Inc, 2026 (https://fingerprint.com) */ declare const ERROR_CODE_CLIENT_TIMEOUT: "client_timeout"; declare const ERROR_CODE_NETWORK_CONNECTION: "network_connection"; declare const ERROR_CODE_NETWORK_ABORT: "network_abort"; declare const ERROR_CODE_CSP_BLOCK: "csp_block"; declare const ERROR_CODE_INVALID_ENDPOINT: "invalid_endpoint"; declare const ERROR_CODE_HANDLE_AGENT_DATA: "handle_agent_data"; declare const ERROR_CODE_SCRIPT_LOAD_FAIL: "script_load_fail"; declare const ERROR_CODE_BAD_RESPONSE_FORMAT: "bad_response_format"; declare const ERROR_CODE_SERVER_ERROR: "server_error"; declare const ERROR_CODE_API_KEY_MISSING: "api_key_missing"; declare const ERROR_CODE_API_KEY_INVALID: "api_key_invalid"; declare const ERROR_CODE_CACHE_MISCONFIGURED: "cache_misconfigured"; declare const ERROR_CODE_ENDPOINTS_MISCONFIGURED: "endpoints_misconfigured"; declare const ERROR_CODE_WRONG_WORKER_OPTION: "wrong_worker_option"; declare const ERROR_CODE_WORKER_INITIALIZATION_FAILED: "worker_initialization_failed"; declare const ERROR_CODE_SANDBOXED_IFRAME: "sandboxed_iframe"; /** * Error code for cases when the script is loaded and executed, but the agent bundle variable is not defined. * Means that the URL of a wrong script is given. * For internal usage only, mustn't be thrown outside the loader. */ declare const ERROR_CODE_BUNDLE_NOT_DEFINED: "bundle_not_defined"; declare const ERROR_CODE_REQUEST_CANNOT_BE_PARSED: "request_cannot_be_parsed"; declare const ERROR_CODE_REQUEST_READ_TIMEOUT: "request_read_timeout"; declare const ERROR_CODE_SECRET_API_KEY_REQUIRED: "secret_api_key_required"; declare const ERROR_CODE_SECRET_API_KEY_NOT_FOUND: "secret_api_key_not_found"; declare const ERROR_CODE_PUBLIC_API_KEY_REQUIRED: "public_api_key_required"; declare const ERROR_CODE_PUBLIC_API_KEY_NOT_FOUND: "public_api_key_not_found"; declare const ERROR_CODE_SUBSCRIPTION_NOT_ACTIVE: "subscription_not_active"; declare const ERROR_CODE_WRONG_REGION: "wrong_region"; declare const ERROR_CODE_FEATURE_NOT_ENABLED: "feature_not_enabled"; declare const ERROR_CODE_REQUEST_NOT_FOUND: "request_not_found"; declare const ERROR_CODE_VISITOR_NOT_FOUND: "visitor_not_found"; declare const ERROR_CODE_TOO_MANY_REQUESTS: "too_many_requests"; declare const ERROR_CODE_STATE_NOT_READY: "state_not_ready"; declare const ERROR_CODE_FAILED: "failed"; declare const ERROR_CODE_EVENT_NOT_FOUND: "event_not_found"; declare const ERROR_CODE_MISSING_MODULE: "missing_module"; declare const ERROR_CODE_PAYLOAD_TOO_LARGE: "payload_too_large"; type ApiErrorCode = typeof ERROR_CODE_REQUEST_CANNOT_BE_PARSED | typeof ERROR_CODE_REQUEST_READ_TIMEOUT | typeof ERROR_CODE_SECRET_API_KEY_REQUIRED | typeof ERROR_CODE_SECRET_API_KEY_NOT_FOUND | typeof ERROR_CODE_PUBLIC_API_KEY_REQUIRED | typeof ERROR_CODE_PUBLIC_API_KEY_NOT_FOUND | typeof ERROR_CODE_SUBSCRIPTION_NOT_ACTIVE | typeof ERROR_CODE_WRONG_REGION | typeof ERROR_CODE_FEATURE_NOT_ENABLED | typeof ERROR_CODE_REQUEST_NOT_FOUND | typeof ERROR_CODE_VISITOR_NOT_FOUND | typeof ERROR_CODE_TOO_MANY_REQUESTS | typeof ERROR_CODE_STATE_NOT_READY | typeof ERROR_CODE_FAILED | typeof ERROR_CODE_EVENT_NOT_FOUND | typeof ERROR_CODE_MISSING_MODULE | typeof ERROR_CODE_PAYLOAD_TOO_LARGE | typeof ERROR_CODE_SANDBOXED_IFRAME; type FingerprintErrorCode = typeof ERROR_CODE_CLIENT_TIMEOUT | typeof ERROR_CODE_NETWORK_CONNECTION | typeof ERROR_CODE_NETWORK_ABORT | typeof ERROR_CODE_CSP_BLOCK | typeof ERROR_CODE_INVALID_ENDPOINT | typeof ERROR_CODE_HANDLE_AGENT_DATA | typeof ERROR_CODE_SCRIPT_LOAD_FAIL | typeof ERROR_CODE_BUNDLE_NOT_DEFINED | typeof ERROR_CODE_BAD_RESPONSE_FORMAT | typeof ERROR_CODE_SERVER_ERROR | typeof ERROR_CODE_API_KEY_MISSING | typeof ERROR_CODE_API_KEY_INVALID | typeof ERROR_CODE_CACHE_MISCONFIGURED | typeof ERROR_CODE_ENDPOINTS_MISCONFIGURED | typeof ERROR_CODE_WRONG_WORKER_OPTION | typeof ERROR_CODE_WORKER_INITIALIZATION_FAILED | ApiErrorCode; /** * Expected error thrown by JS Agent */ interface FingerprintErrorInterface extends Error { name: 'FingerprintError'; /** A machine-friendly code for the type of this error */ code: FingerprintErrorCode; /** A unique id to refer to the error. Available only for errors originate on the server side. */ event_id: string | null; } /** * Type guard to check if an error is a FingerprintError */ declare function isFingerprintError(error: unknown): error is FingerprintErrorInterface; interface BinaryOutput { byteArray(): Uint8Array; blob(): Blob; base64(): string; toJSON(): string; toString(): string; [Symbol.toPrimitive](hint: 'number' | 'string' | 'default'): string; } type PublicGetResult = { /** * Whether the result was obtained from the cache (instead of requesting from Fingerprint backend). * This field is only present when caching is enabled. */ cache_hit?: boolean; /** * A unique id associated with the successful request. */ event_id: string; /** * The visitor identifier. * Backend excludes this field if zeroTrust mode is enabled. */ visitor_id?: string; /** * Suspect score. * Backend includes this field only if Smart Signals are enabled. */ suspect_score?: number; /** * Sealed result, which is an encrypted content of the `/events` Server API response for this eventId, encoded in * base64. The field will miss if Sealed Results are disabled or unavailable for another reason. * Reach the support to enable. */ sealed_result: BinaryOutput | null; }; /** * Result of collecting on demand fingerprint data */ type CollectResult = string; declare const enum CacheLocation { SessionStorage = "sessionStorage", LocalStorage = "localStorage", Agent = "agent" } declare const enum CacheDuration { OptimizeCost = "optimize-cost",// 1hour Aggressive = "aggressive" } type Region = /** N. Virginia, USA */ 'us' /** Frankfurt, Germany */ | 'eu' /** Mumbai, India */ | 'ap'; declare const withoutDefaultType = "withoutDefault"; /** * This object wraps a parameter to tell JS Agent that you don't want to use the default value. * Don't compose it manually, use `withoutDefault` instead. */ type WithoutDefault = { readonly __type__: typeof withoutDefaultType; readonly value: T; }; /** * One or many endpoint URLs. * If multiple URLs are given, the agent will try them one by one until it finds a working one. * If an empty array is given, the agent will use default fallback value. */ type EndpointUrl = string | readonly string[]; /** * An endpoint for a specific HTTPS request. * - Passing an `EndpointUrl` uses that URL, with the default still available as a fallback. * - Wrapping with `withoutDefault(...)` disables fallback and uses only the provided value. */ type Endpoint = EndpointUrl | WithoutDefault; /** * Configuration for caching agent results. * Specified via the `cache` option in `LoaderStartOptions`. * Disabled by default when not provided. */ type CacheConfig = { /** The storage location for the cache: `'sessionStorage'`, `'localStorage'`, or `'agent'` (memory). Required. */ storage: `${CacheLocation}`; /** * The cache duration in seconds. * Can be a predefined value (`'optimize-cost'` = 1 hour, `'aggressive'` = 12 hours) or a custom number. * Max value is `43200` (12 hours). Required. **/ duration: `${CacheDuration}` | number; /** Optional prefix for cache keys. Defaults to none. */ cachePrefix?: string; }; type UrlHashing = { /** Set to `true` to hash the path part of the URL (between the origin and `?`) */ path?: boolean; /** Set to `true` to hash the query part of the URL (between `?` and `#`) */ query?: boolean; /** Set to `true` to hash the fragment part of the URL (after `#`) */ fragment?: boolean; }; type LoaderStartOptions = { /** * Public API key */ apiKey: string; /** * Region of the Fingerprint service server * @default 'us' */ region?: Region; /** * API endpoints used by JS Agent */ endpoints?: Endpoint; /** * Override storages name (cookies, localStorage, etc). * Should only be used when the default name conflicts with some of your existing names. * @default '_vid_' */ storageKeyPrefix?: string; /** * Information about libraries and services used to integrate the JS agent. * Each array item means a separate integration, the order doesn't matter. * An example of an integration library is Fingerprint React SDK. */ integrationInfo?: readonly string[]; /** * Enables data collection for remote control detection. * Once enabled, please contact our support team to activate the result exposure. * @see https://fingerprint.com/support/ * * @default false * * @see https://dev.fingerprint.com/docs/smart-signals-overview#remote-control-tools-detection */ remoteControlDetection?: boolean; /** * Hashes URL parts before sending them to Fingerprint the server. * The sources of URLs: window.location.href, document.referrer. * Сan be used to hide sensitive data (tokens, payment info, etc) that these URLs may contain. * * Example of URL stripping 'https://example.com/path?token=secret#anchor' -> 'https://example.com/oK-fhlv2N-ZzaBf0zlUuTN97jDbqdbwlTB0fCvdEtb8?E1kifZXhuoBEZ_zkQa60jyxcaHNX3QFaydaaIEtL7j0#eb-w4rp2udRHYG3bzElINPBaTBHesFLnS0nqMHo8W80' */ urlHashing?: UrlHashing; /** * Enables caching the result of the `get` call. * Has no default value and cache is not being used if not specified. * @see CacheConfig for details. * @default: undefined - caching is disabled */ cache?: CacheConfig; }; /** * Any simple value or an object (not arrays) * Constraint: the size must not exceed 16KB. */ type TagPrimitive = string | number | boolean; type TagValueObject = { [key: string]: TagValue | TagValue[]; }; type TagValue = null | TagPrimitive | TagValueObject; /** * Options for requesting the visitor information */ type PublicGetOptions = { /** * Controls client-side timeout. Client timeout controls total time (both client-side and server-side) that any * identification event is allowed to run. It doesn't include time when the page is in background (not visible). * The value is in milliseconds. * @default 10000 */ timeout?: number; tag?: TagValue; /** * `Tags` is a user-provided value or object that will be returned back to you in a webhook message. * You may want to use the `tags` value to be able to associate a server-side webhook event with a web request of * the current visitor. * * What values can be used as `tags`? * Anything that identifies a visitor or a request. * You can pass the event_id as `tags` and then get this event_id back in the webhook, associated with a visitorId. * * If both `tag` and `tags` are provided, `tags` takes precedence. */ tags?: TagValue; /** * `linkedId` is a way of linking current identification event with a custom identifier. * This can be helpful to be able to filter API visit information later. */ linkedId?: string; }; /** * Options of collecting on demand fingerprint data */ type PublicCollectOptions = PublicGetOptions; /** * Options of handling on demand agent data */ type PublicHandleAgentDataOptions = { /** * Override storages name (cookies, localStorage, etc). * Should only be used when the default name conflicts with some of your existing names. * @default '_vid' */ storageKeyPrefix?: string; }; /** * Wraps a parameter to tell JS Agent that you don't want to use the default value */ declare function withoutDefault(value: T): WithoutDefault; /** * Agent object that can get visitor identifier */ interface PublicAgent { /** * Gets the visitor identifier. * See the `ERROR_...` constants for expected error messages. * When an error is emitted by the backend, it gets a `event_id` field, same as in successful result. */ get(options?: Readonly): Promise; /** * Collects on demand fingerprint data. */ collect(options?: Readonly): Promise; } /** * Handles the on demand agent data sent from the remote agent. * Intended for use in integrations where response data is received out-of-band (via /send endpoint). * * @throws FingerprintError with code 'handle_agent_data' if `response` is malformed. */ declare const publicHandleAgentData: (data: string, options?: Readonly) => void; type StartOptions = LoaderStartOptions; declare const start: (options: StartOptions) => PublicAgent; declare const _default: { start: (options: StartOptions) => PublicAgent; handleAgentData: (data: string, options?: Readonly) => void; isFingerprintError: typeof isFingerprintError; withoutDefault: typeof withoutDefault; }; export { _default as default, publicHandleAgentData as handleAgentData, isFingerprintError, start, withoutDefault }; export type { PublicAgent as Agent, FingerprintErrorInterface as Error, FingerprintErrorCode as ErrorCode, PublicGetOptions as GetOptions, PublicGetResult as GetResult, StartOptions };