@fingerprintiq/js 0.1.0 → 0.2.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.
package/dist/index.d.cts CHANGED
@@ -4,6 +4,16 @@ interface FingerprintIQConfig {
4
4
  endpoint?: string;
5
5
  timeout?: number;
6
6
  detectWallets?: boolean;
7
+ cache?: CacheConfig | false;
8
+ }
9
+ interface IdentifyOptions {
10
+ tag?: unknown;
11
+ linkedId?: string;
12
+ timeout?: number;
13
+ }
14
+ interface CacheConfig {
15
+ storage: "sessionStorage" | "localStorage";
16
+ ttl?: number;
7
17
  }
8
18
  interface SignalResult<T = unknown> {
9
19
  value: T;
@@ -379,28 +389,117 @@ interface ClientSignals {
379
389
  virtualization: SignalResult<VirtualizationSignal> | null;
380
390
  rooted: SignalResult<RootedSignal> | null;
381
391
  }
392
+ interface Verdicts {
393
+ bot: {
394
+ result: boolean;
395
+ probability: number;
396
+ };
397
+ vpn: {
398
+ result: boolean;
399
+ confidence: number;
400
+ };
401
+ tor: {
402
+ result: boolean;
403
+ };
404
+ proxy: {
405
+ result: boolean;
406
+ };
407
+ incognito: {
408
+ result: boolean;
409
+ };
410
+ tampering: {
411
+ result: boolean;
412
+ anomalyScore: number;
413
+ };
414
+ headless: {
415
+ result: boolean;
416
+ };
417
+ virtualMachine: {
418
+ result: boolean;
419
+ };
420
+ devtools: {
421
+ result: boolean;
422
+ };
423
+ privacyBrowser: {
424
+ result: boolean;
425
+ name: string | null;
426
+ };
427
+ highActivity: {
428
+ result: boolean;
429
+ };
430
+ ipBlocklist: {
431
+ result: boolean;
432
+ };
433
+ velocity?: {
434
+ distinctIp: {
435
+ "5m": number;
436
+ "1h": number;
437
+ "24h": number;
438
+ };
439
+ distinctCountry: {
440
+ "5m": number;
441
+ "1h": number;
442
+ "24h": number;
443
+ };
444
+ events: {
445
+ "5m": number;
446
+ "1h": number;
447
+ "24h": number;
448
+ };
449
+ };
450
+ }
451
+ interface IpLocation {
452
+ country: string;
453
+ city: string;
454
+ region: string;
455
+ latitude: number;
456
+ longitude: number;
457
+ }
458
+ interface SybilRisk {
459
+ score: number;
460
+ level: string;
461
+ reasons: string[];
462
+ }
382
463
  interface IdentifyResponse {
464
+ requestId: string;
383
465
  visitorId: string;
384
466
  confidence: number;
385
467
  botProbability: number;
386
- signals: Record<string, unknown>;
387
- wallets?: WalletSignal;
388
- timestamp: number;
468
+ suspectScore: number;
389
469
  visitCount: number;
390
470
  firstSeenAt: number;
471
+ lastSeenAt: number | null;
472
+ riskFactors: string[];
473
+ verdicts: Verdicts;
474
+ ip: string;
475
+ ipLocation: IpLocation;
476
+ sybilRisk?: SybilRisk;
477
+ web3?: {
478
+ walletsDetected: string[];
479
+ connectedWallets: unknown[];
480
+ sybilAnalysis: unknown;
481
+ };
482
+ timestamp: number;
483
+ cacheHit?: boolean;
484
+ /** Base64-encoded AES-256-GCM encrypted payload containing full event data. Only present when a sealed key is active. Decrypt server-side with @fingerprintiq/server. */
485
+ sealedResult?: string;
391
486
  }
392
487
 
393
488
  declare function getDiscoveredAddresses(): string[];
394
- declare function requestWalletConnection(): Promise<string | null>;
489
+ declare function requestWalletConnection(wallet?: string): Promise<string | null>;
395
490
 
396
491
  declare class FingerprintIQ {
397
492
  private readonly apiKey;
398
493
  private readonly endpoint;
399
494
  private readonly timeout;
400
495
  private readonly detectWallets;
496
+ private readonly cache;
401
497
  constructor(config: FingerprintIQConfig);
402
498
  private ensureClientHintsBootstrapped;
403
- identify(): Promise<IdentifyResponse>;
499
+ identify(options?: IdentifyOptions): Promise<IdentifyResponse>;
500
+ private getCacheKey;
501
+ private readCache;
502
+ private writeCache;
404
503
  }
405
504
 
406
- export { type AudioSignal, type BehavioralRiskSignal, type CanvasSignal, type CapabilityVectorSignal, type ClientSignals, type CodecSignal, type CssStyleSignal, type DOMRectSignal, type ErrorSignal, type FingerprintIQConfig, type FontSignal, type GeometryVectorSignal, type HeadlessSignal, type HtmlElementSignal, type IdentifyResponse, type IntegritySignal, type IntlSignal, type MathSignal, type MediaSignal, type NavigatorSignal, type PlatformFeaturesSignal, type ResistanceSignal, type RuntimeVectorSignal, type ScreenSignal, type SensorCapabilitiesSignal, type SpeechSignal, type StatusSignal, type StorageSignal, type SvgSignal, type TimezoneSignal, type UAClientHintsBrand, type UAClientHintsSignal, type WalletSignal, type WasmTimingSignal, type WebGLSignal, type WebGPUSignal, type WebRTCSignal, type WindowFeaturesSignal, type WorkerScopeSignal, FingerprintIQ as default, getDiscoveredAddresses, requestWalletConnection };
505
+ export { type AudioSignal, type BehavioralRiskSignal, type CacheConfig, type CanvasSignal, type CapabilityVectorSignal, type ClientSignals, type CodecSignal, type CssStyleSignal, type DOMRectSignal, type ErrorSignal, type FingerprintIQConfig, type FontSignal, type GeometryVectorSignal, type HeadlessSignal, type HtmlElementSignal, type IdentifyOptions, type IdentifyResponse, type IntegritySignal, type IntlSignal, type IpLocation, type MathSignal, type MediaSignal, type NavigatorSignal, type PlatformFeaturesSignal, type ResistanceSignal, type RuntimeVectorSignal, type ScreenSignal, type SensorCapabilitiesSignal, type SpeechSignal, type StatusSignal, type StorageSignal, type SvgSignal, type SybilRisk, type TimezoneSignal, type UAClientHintsBrand, type UAClientHintsSignal, type Verdicts, type WalletSignal, type WasmTimingSignal, type WebGLSignal, type WebGPUSignal, type WebRTCSignal, type WindowFeaturesSignal, type WorkerScopeSignal, FingerprintIQ as default, getDiscoveredAddresses, requestWalletConnection };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,16 @@ interface FingerprintIQConfig {
4
4
  endpoint?: string;
5
5
  timeout?: number;
6
6
  detectWallets?: boolean;
7
+ cache?: CacheConfig | false;
8
+ }
9
+ interface IdentifyOptions {
10
+ tag?: unknown;
11
+ linkedId?: string;
12
+ timeout?: number;
13
+ }
14
+ interface CacheConfig {
15
+ storage: "sessionStorage" | "localStorage";
16
+ ttl?: number;
7
17
  }
8
18
  interface SignalResult<T = unknown> {
9
19
  value: T;
@@ -379,28 +389,117 @@ interface ClientSignals {
379
389
  virtualization: SignalResult<VirtualizationSignal> | null;
380
390
  rooted: SignalResult<RootedSignal> | null;
381
391
  }
392
+ interface Verdicts {
393
+ bot: {
394
+ result: boolean;
395
+ probability: number;
396
+ };
397
+ vpn: {
398
+ result: boolean;
399
+ confidence: number;
400
+ };
401
+ tor: {
402
+ result: boolean;
403
+ };
404
+ proxy: {
405
+ result: boolean;
406
+ };
407
+ incognito: {
408
+ result: boolean;
409
+ };
410
+ tampering: {
411
+ result: boolean;
412
+ anomalyScore: number;
413
+ };
414
+ headless: {
415
+ result: boolean;
416
+ };
417
+ virtualMachine: {
418
+ result: boolean;
419
+ };
420
+ devtools: {
421
+ result: boolean;
422
+ };
423
+ privacyBrowser: {
424
+ result: boolean;
425
+ name: string | null;
426
+ };
427
+ highActivity: {
428
+ result: boolean;
429
+ };
430
+ ipBlocklist: {
431
+ result: boolean;
432
+ };
433
+ velocity?: {
434
+ distinctIp: {
435
+ "5m": number;
436
+ "1h": number;
437
+ "24h": number;
438
+ };
439
+ distinctCountry: {
440
+ "5m": number;
441
+ "1h": number;
442
+ "24h": number;
443
+ };
444
+ events: {
445
+ "5m": number;
446
+ "1h": number;
447
+ "24h": number;
448
+ };
449
+ };
450
+ }
451
+ interface IpLocation {
452
+ country: string;
453
+ city: string;
454
+ region: string;
455
+ latitude: number;
456
+ longitude: number;
457
+ }
458
+ interface SybilRisk {
459
+ score: number;
460
+ level: string;
461
+ reasons: string[];
462
+ }
382
463
  interface IdentifyResponse {
464
+ requestId: string;
383
465
  visitorId: string;
384
466
  confidence: number;
385
467
  botProbability: number;
386
- signals: Record<string, unknown>;
387
- wallets?: WalletSignal;
388
- timestamp: number;
468
+ suspectScore: number;
389
469
  visitCount: number;
390
470
  firstSeenAt: number;
471
+ lastSeenAt: number | null;
472
+ riskFactors: string[];
473
+ verdicts: Verdicts;
474
+ ip: string;
475
+ ipLocation: IpLocation;
476
+ sybilRisk?: SybilRisk;
477
+ web3?: {
478
+ walletsDetected: string[];
479
+ connectedWallets: unknown[];
480
+ sybilAnalysis: unknown;
481
+ };
482
+ timestamp: number;
483
+ cacheHit?: boolean;
484
+ /** Base64-encoded AES-256-GCM encrypted payload containing full event data. Only present when a sealed key is active. Decrypt server-side with @fingerprintiq/server. */
485
+ sealedResult?: string;
391
486
  }
392
487
 
393
488
  declare function getDiscoveredAddresses(): string[];
394
- declare function requestWalletConnection(): Promise<string | null>;
489
+ declare function requestWalletConnection(wallet?: string): Promise<string | null>;
395
490
 
396
491
  declare class FingerprintIQ {
397
492
  private readonly apiKey;
398
493
  private readonly endpoint;
399
494
  private readonly timeout;
400
495
  private readonly detectWallets;
496
+ private readonly cache;
401
497
  constructor(config: FingerprintIQConfig);
402
498
  private ensureClientHintsBootstrapped;
403
- identify(): Promise<IdentifyResponse>;
499
+ identify(options?: IdentifyOptions): Promise<IdentifyResponse>;
500
+ private getCacheKey;
501
+ private readCache;
502
+ private writeCache;
404
503
  }
405
504
 
406
- export { type AudioSignal, type BehavioralRiskSignal, type CanvasSignal, type CapabilityVectorSignal, type ClientSignals, type CodecSignal, type CssStyleSignal, type DOMRectSignal, type ErrorSignal, type FingerprintIQConfig, type FontSignal, type GeometryVectorSignal, type HeadlessSignal, type HtmlElementSignal, type IdentifyResponse, type IntegritySignal, type IntlSignal, type MathSignal, type MediaSignal, type NavigatorSignal, type PlatformFeaturesSignal, type ResistanceSignal, type RuntimeVectorSignal, type ScreenSignal, type SensorCapabilitiesSignal, type SpeechSignal, type StatusSignal, type StorageSignal, type SvgSignal, type TimezoneSignal, type UAClientHintsBrand, type UAClientHintsSignal, type WalletSignal, type WasmTimingSignal, type WebGLSignal, type WebGPUSignal, type WebRTCSignal, type WindowFeaturesSignal, type WorkerScopeSignal, FingerprintIQ as default, getDiscoveredAddresses, requestWalletConnection };
505
+ export { type AudioSignal, type BehavioralRiskSignal, type CacheConfig, type CanvasSignal, type CapabilityVectorSignal, type ClientSignals, type CodecSignal, type CssStyleSignal, type DOMRectSignal, type ErrorSignal, type FingerprintIQConfig, type FontSignal, type GeometryVectorSignal, type HeadlessSignal, type HtmlElementSignal, type IdentifyOptions, type IdentifyResponse, type IntegritySignal, type IntlSignal, type IpLocation, type MathSignal, type MediaSignal, type NavigatorSignal, type PlatformFeaturesSignal, type ResistanceSignal, type RuntimeVectorSignal, type ScreenSignal, type SensorCapabilitiesSignal, type SpeechSignal, type StatusSignal, type StorageSignal, type SvgSignal, type SybilRisk, type TimezoneSignal, type UAClientHintsBrand, type UAClientHintsSignal, type Verdicts, type WalletSignal, type WasmTimingSignal, type WebGLSignal, type WebGPUSignal, type WebRTCSignal, type WindowFeaturesSignal, type WorkerScopeSignal, FingerprintIQ as default, getDiscoveredAddresses, requestWalletConnection };