vesant-sdk 1.7.0 → 1.7.1-dev.0520b46

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.
Files changed (75) hide show
  1. package/dist/{client-B0qhE2kr.d.mts → client-5q4whhGu.d.mts} +2 -2
  2. package/dist/{client-DF7hlMEz.d.ts → client-BaUekQT8.d.ts} +96 -52
  3. package/dist/{client-DtH2RLuy.d.ts → client-DUHC-68_.d.ts} +2 -2
  4. package/dist/{client-DrjgZoH_.d.mts → client-XDEhh9VN.d.mts} +96 -52
  5. package/dist/{client-BolQlL5e.d.mts → client-q9fN8Hhf.d.mts} +103 -1
  6. package/dist/{client-BolQlL5e.d.ts → client-q9fN8Hhf.d.ts} +103 -1
  7. package/dist/compliance/index.d.mts +3 -3
  8. package/dist/compliance/index.d.ts +3 -3
  9. package/dist/compliance/index.js +218 -90
  10. package/dist/compliance/index.js.map +1 -1
  11. package/dist/compliance/index.mjs +218 -90
  12. package/dist/compliance/index.mjs.map +1 -1
  13. package/dist/decisions/index.d.mts +1 -1
  14. package/dist/decisions/index.d.ts +1 -1
  15. package/dist/decisions/index.js +69 -8
  16. package/dist/decisions/index.js.map +1 -1
  17. package/dist/decisions/index.mjs +69 -8
  18. package/dist/decisions/index.mjs.map +1 -1
  19. package/dist/geolocation/index.d.mts +68 -7
  20. package/dist/geolocation/index.d.ts +68 -7
  21. package/dist/geolocation/index.js +223 -90
  22. package/dist/geolocation/index.js.map +1 -1
  23. package/dist/geolocation/index.mjs +220 -91
  24. package/dist/geolocation/index.mjs.map +1 -1
  25. package/dist/index-C3zUKydT.d.mts +264 -0
  26. package/dist/index-DSDgS09k.d.ts +264 -0
  27. package/dist/index.d.mts +27 -10
  28. package/dist/index.d.ts +27 -10
  29. package/dist/index.js +418 -126
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +409 -127
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/kyc/core.d.mts +2 -2
  34. package/dist/kyc/core.d.ts +2 -2
  35. package/dist/kyc/core.js +102 -21
  36. package/dist/kyc/core.js.map +1 -1
  37. package/dist/kyc/core.mjs +102 -22
  38. package/dist/kyc/core.mjs.map +1 -1
  39. package/dist/kyc/index.d.mts +154 -30
  40. package/dist/kyc/index.d.ts +154 -30
  41. package/dist/kyc/index.js +102 -21
  42. package/dist/kyc/index.js.map +1 -1
  43. package/dist/kyc/index.mjs +102 -22
  44. package/dist/kyc/index.mjs.map +1 -1
  45. package/dist/react.d.mts +14 -3
  46. package/dist/react.d.ts +14 -3
  47. package/dist/react.js +317 -68
  48. package/dist/react.js.map +1 -1
  49. package/dist/react.mjs +317 -68
  50. package/dist/react.mjs.map +1 -1
  51. package/dist/risk-profile/index.d.mts +1 -1
  52. package/dist/risk-profile/index.d.ts +1 -1
  53. package/dist/risk-profile/index.js +69 -8
  54. package/dist/risk-profile/index.js.map +1 -1
  55. package/dist/risk-profile/index.mjs +69 -8
  56. package/dist/risk-profile/index.mjs.map +1 -1
  57. package/dist/scores/index.d.mts +1 -1
  58. package/dist/scores/index.d.ts +1 -1
  59. package/dist/scores/index.js +69 -8
  60. package/dist/scores/index.js.map +1 -1
  61. package/dist/scores/index.mjs +69 -8
  62. package/dist/scores/index.mjs.map +1 -1
  63. package/dist/tax/index.d.mts +2 -2
  64. package/dist/tax/index.d.ts +2 -2
  65. package/dist/tax/index.js +74 -10
  66. package/dist/tax/index.js.map +1 -1
  67. package/dist/tax/index.mjs +74 -10
  68. package/dist/tax/index.mjs.map +1 -1
  69. package/dist/webhooks/index.d.mts +2 -189
  70. package/dist/webhooks/index.d.ts +2 -189
  71. package/dist/webhooks/index.js +85 -21
  72. package/dist/webhooks/index.js.map +1 -1
  73. package/dist/webhooks/index.mjs +85 -22
  74. package/dist/webhooks/index.mjs.map +1 -1
  75. package/package.json +4 -1
@@ -1,6 +1,6 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-DrjgZoH_.mjs';
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-XDEhh9VN.mjs';
2
2
  import { RiskProfileClient } from './risk-profile/index.mjs';
3
- import { V as VesantConfig, R as RequestOptions } from './client-BolQlL5e.mjs';
3
+ import { V as VesantConfig, R as RequestOptions } from './client-q9fN8Hhf.mjs';
4
4
  import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
5
5
  import { E as EntityType, B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.mjs';
6
6
 
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-BolQlL5e.js';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-q9fN8Hhf.js';
2
2
  import { B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.js';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -47,6 +47,8 @@ interface CipherTextPayload {
47
47
  heading?: number;
48
48
  speed?: number;
49
49
  timestamp: number;
50
+ /** Advisory client-side GPS integrity flags; the server weighs these as risk factors. */
51
+ integrity_flags?: string[];
50
52
  };
51
53
  /** Network information */
52
54
  network?: {
@@ -74,9 +76,12 @@ type CipherTextReason = 'registration' | 'login' | 'transaction' | 'interval_che
74
76
  interface CipherTextOptions {
75
77
  /** Reason for collection (required) */
76
78
  reason: CipherTextReason;
77
- /** Public signing key (pk_) for HMAC signing (produces v02 signed cipherText) */
79
+ /**
80
+ * @deprecated No longer used and ignored; envelope validation is handled by the
81
+ * server. This field will be removed in a future release.
82
+ */
78
83
  signingKey?: string;
79
- /** @deprecated Use signingKey instead. API key for HMAC signing (backward compat) */
84
+ /** @deprecated No longer used and ignored; see signingKey. */
80
85
  apiKey?: string;
81
86
  /** Request GPS location (default: false) */
82
87
  requestLocation?: boolean;
@@ -106,6 +111,11 @@ interface CipherTextResult {
106
111
  /** Expiry time for the cipherText */
107
112
  expiresAt: string;
108
113
  }
114
+ /**
115
+ * Honest name for CipherTextResult: a base64 JSON device-signals envelope
116
+ * (not encryption). Prefer this name; `CipherTextResult` remains as an alias.
117
+ */
118
+ type DeviceSignalsEnvelope = CipherTextResult;
109
119
  /**
110
120
  * Decrypted cipherText data (returned by server after validation)
111
121
  */
@@ -164,6 +174,21 @@ interface ValidateCipherTextRequest {
164
174
  * has complete customer information (name, email, etc.)
165
175
  */
166
176
  customer_data?: CipherTextCustomerData;
177
+ /**
178
+ * Single-use device-signals nonce from {@link SignalsNonce}. Bound to the
179
+ * tenant, user, and event; consumed server-side so the submission can't be
180
+ * replayed. Attached automatically by the client.
181
+ */
182
+ nonce?: string;
183
+ }
184
+ /**
185
+ * A short-lived, single-use device-signals nonce minted by the server. Bind a
186
+ * device-signals submission to a specific tenant, user, and event type so a
187
+ * captured envelope can't be replayed. Integrity is enforced server-side.
188
+ */
189
+ interface SignalsNonce {
190
+ nonce: string;
191
+ expires_at: string;
167
192
  }
168
193
  /**
169
194
  * Response from cipherText validation
@@ -227,7 +252,11 @@ interface ValidateCipherTextResponse {
227
252
  };
228
253
  }
229
254
  interface VerifyIPRequest {
230
- ip_address: string;
255
+ /**
256
+ * Optional. Omit to let the server derive the connecting IP — the SDK never
257
+ * asserts the client IP (spoofable, and the server extracts it authoritatively).
258
+ */
259
+ ip_address?: string;
231
260
  user_id: string;
232
261
  event_type: string;
233
262
  device_fingerprint?: DeviceFingerprintRequest;
@@ -483,7 +512,9 @@ interface GeolocationConfigResponse {
483
512
  };
484
513
  /** When true, GPS-verified location overrides anonymizer-based blocking */
485
514
  trust_gps_over_anonymizer: boolean;
486
- /** Public signing key (pk_) for client-side HMAC signing */
515
+ /**
516
+ * @deprecated No longer used by the SDK and ignored if present.
517
+ */
487
518
  signing_key?: string;
488
519
  }
489
520
  interface GeolocationClientConfig {
@@ -503,6 +534,15 @@ interface GeolocationClientConfig {
503
534
  logger?: Logger;
504
535
  /** Environment mode - 'sandbox' uses isolated sandbox data */
505
536
  environment?: 'production' | 'sandbox';
537
+ /**
538
+ * How long a fetched GPS requirement config is reused before it is read again,
539
+ * in milliseconds (default: 300000, i.e. 5 minutes).
540
+ *
541
+ * These requirements are edited in the compliance console while your
542
+ * application is running, so a lower value makes changes take effect sooner at
543
+ * the cost of more requests. Use `refreshGPSConfig()` to re-read immediately.
544
+ */
545
+ gpsConfigTtlMs?: number;
506
546
  }
507
547
  interface UseGeolocationOptions {
508
548
  /** Auto-detect and verify user's IP on mount */
@@ -624,16 +664,6 @@ interface ResendLocationRequestRequest {
624
664
  email?: string;
625
665
  phone?: string;
626
666
  }
627
- interface WiFiNetwork {
628
- /** MAC address (BSSID) */
629
- macAddress: string;
630
- /** Signal strength in dBm (negative number) */
631
- signalStrength?: number;
632
- /** WiFi channel */
633
- channel?: number;
634
- /** Network name (optional) */
635
- ssid?: string;
636
- }
637
667
  interface LocationCaptureRequest {
638
668
  /** GPS latitude (if available) */
639
669
  latitude?: number;
@@ -641,8 +671,8 @@ interface LocationCaptureRequest {
641
671
  longitude?: number;
642
672
  /** GPS accuracy in meters */
643
673
  accuracy?: number;
644
- /** WiFi networks for positioning (if GPS not available) */
645
- wifi_networks?: WiFiNetwork[];
674
+ /** Advisory client-side GPS integrity flags; the server weighs these as risk factors. */
675
+ integrity_flags?: string[];
646
676
  /** User agent string */
647
677
  user_agent?: string;
648
678
  /** Device metadata */
@@ -662,6 +692,10 @@ interface LocationShareInfo {
662
692
  status: string;
663
693
  is_expired: boolean;
664
694
  is_completed: boolean;
695
+ /**
696
+ * Server-only hint. The web SDK cannot enumerate WiFi networks (no browser API
697
+ * for BSSIDs); this flag is informational and never satisfied client-side.
698
+ */
665
699
  requires_wifi: boolean;
666
700
  }
667
701
  interface LocationCaptureResponse {
@@ -730,8 +764,6 @@ interface UseLocationCaptureOptions {
730
764
  autoFetch?: boolean;
731
765
  /** Auto-request GPS permission on mount */
732
766
  autoRequestGPS?: boolean;
733
- /** Collect WiFi data as fallback (requires explicit permission) */
734
- collectWiFi?: boolean;
735
767
  }
736
768
  interface UseLocationCaptureResult {
737
769
  /** Location share info */
@@ -763,18 +795,9 @@ interface UseLocationCaptureResult {
763
795
  * Extends BaseClient for consistent retry logic, timeout handling, and error management.
764
796
  */
765
797
 
766
- /**
767
- * GeolocationClient extends BaseClient for:
768
- * - Consistent retry logic with exponential backoff
769
- * - Unified error handling (VesantError, NetworkError, TimeoutError, etc.)
770
- * - Automatic timeout management
771
- * - Debug logging
772
- *
773
- * All geolocation verification calls use requestWithRetry() to handle
774
- * transient failures gracefully.
775
- */
776
798
  declare class GeolocationClient extends BaseClient {
777
- private cachedSigningKey?;
799
+ private readonly gpsConfigTtlMs;
800
+ private gpsConfigCache;
778
801
  constructor(config: GeolocationClientConfig);
779
802
  /**
780
803
  * Verify an IP address and check compliance
@@ -836,14 +859,45 @@ declare class GeolocationClient extends BaseClient {
836
859
  */
837
860
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
838
861
  /**
839
- * Fetch the signing key from the dedicated authenticated endpoint.
862
+ * Re-read the tenant's GPS requirement configuration, ignoring any copy held
863
+ * from an earlier read.
864
+ *
865
+ * These requirements are edited in the compliance console while your
866
+ * application is running. `getGPSConfig` reuses a fetched copy for a short
867
+ * period so a long-lived session does not call the API on every event; call
868
+ * this when you need a change to take effect immediately — for example right
869
+ * after an administrator saves new settings.
870
+ *
871
+ * @returns The current GPS requirement config per event type
872
+ *
873
+ * @example
874
+ * ```typescript
875
+ * const config = await client.refreshGPSConfig();
876
+ * if (config.require_gps.login) {
877
+ * // GPS is now required for login
878
+ * }
879
+ * ```
880
+ */
881
+ refreshGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
882
+ /**
883
+ * Mint a short-lived, single-use device-signals nonce.
840
884
  *
841
- * Falls back to getGPSConfig() for backward compatibility with older servers
842
- * that don't expose `/api/v1/geo/signing-key`.
885
+ * The nonce is bound to the tenant, user, and event type and is consumed
886
+ * server-side during validation, so a captured device-signals envelope cannot
887
+ * be replayed. `validateCipherText` mints and attaches one automatically; call
888
+ * this directly only if you manage the nonce yourself.
843
889
  *
844
- * @returns The signing key string, or undefined if unavailable
890
+ * @param userId - User ID the nonce is bound to
891
+ * @param eventType - Event type the nonce is bound to (login, registration, ...)
892
+ * @returns The nonce and its expiry
893
+ */
894
+ fetchSignalsNonce(userId: string, eventType: CipherTextReason, requestOptions?: RequestOptions): Promise<SignalsNonce>;
895
+ /**
896
+ * Best-effort nonce mint for validation. Returns undefined if minting fails —
897
+ * the server is the sole authority and blocks when a nonce is required, so this
898
+ * never downgrades security on the client's say-so.
845
899
  */
846
- fetchSigningKey(requestOptions?: RequestOptions): Promise<string | undefined>;
900
+ private resolveSignalsNonce;
847
901
  /**
848
902
  * Validate a cipherText generated by the frontend SDK
849
903
  *
@@ -995,40 +1049,30 @@ declare class GeolocationClient extends BaseClient {
995
1049
  *
996
1050
  * @example
997
1051
  * ```typescript
998
- * // Using GPS (preferred)
1052
+ * // GPS (the web SDK is GPS + IP only; the server handles the IP fallback)
999
1053
  * const result = await client.captureLocation(token, {
1000
1054
  * latitude: 37.7749,
1001
1055
  * longitude: -122.4194,
1002
1056
  * accuracy: 10
1003
1057
  * });
1004
- *
1005
- * // Using WiFi positioning (fallback)
1006
- * const result = await client.captureLocation(token, {
1007
- * wifi_networks: [
1008
- * { macAddress: "00:11:22:33:44:55", signalStrength: -50 },
1009
- * { macAddress: "AA:BB:CC:DD:EE:FF", signalStrength: -70 }
1010
- * ]
1011
- * });
1012
1058
  * ```
1013
1059
  */
1014
1060
  captureLocation(token: string, capture: LocationCaptureRequest, requestOptions?: RequestOptions): Promise<LocationCaptureResponse>;
1015
1061
  /**
1016
- * Generate a signed cipherText containing device and location data.
1017
- *
1018
- * Automatically passes the client's API key for HMAC signing (v02 format).
1019
- * If no API key is configured, falls back to unsigned v01 format.
1062
+ * Generate a device-signals envelope containing device and location data,
1063
+ * validated by the server.
1020
1064
  *
1021
- * @param options - Options for cipherText generation
1065
+ * @param options - Options for envelope generation
1022
1066
  * @param gpsConfig - Optional GPS config (from getGPSConfig)
1023
- * @returns CipherText result with the signed string
1067
+ * @returns The device-signals envelope result
1024
1068
  *
1025
1069
  * @example
1026
1070
  * ```typescript
1027
1071
  * const result = await client.generateCipherText({ reason: 'login' });
1028
- * console.log(result.cipherText); // v02 signed cipherText
1072
+ * console.log(result.cipherText); // device-signals envelope
1029
1073
  * ```
1030
1074
  */
1031
1075
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1032
1076
  }
1033
1077
 
1034
- export { type UseLocationRequestsResult as $, type APIError as A, type GeolocationClientConfig as B, type CipherTextCustomerData as C, type DeviceFingerprintRequest as D, type GeolocationConfigResponse as E, type GeolocationRecord as F, GeolocationClient as G, type LocationCaptureRequest as H, type LocationCaptureResponse as I, type JurisdictionConfig as J, type LocationRequestChannel as K, type LocationVerification as L, type LocationRequestResult as M, type LocationRequestStatus as N, type LocationShareInfo as O, type UpdateGeofenceRuleRequest as P, type UpdateJurisdictionRequest as Q, type ResendLocationRequestRequest as R, type UseAlertsOptions as S, type UseAlertsResult as T, type UpdateDeviceTrustRequest as U, type ValidateCipherTextResponse as V, type UseGeolocationOptions as W, type UseGeolocationResult as X, type UseLocationCaptureOptions as Y, type UseLocationCaptureResult as Z, type UseLocationRequestsOptions as _, type LocationRequest as a, type ValidateCipherTextRequest as a0, type VerifyIPRequest as a1, type WiFiNetwork as a2, type LocationRequestFilters as b, type LocationRequestListResponse as c, type AlertFilters as d, type AlertListResponse as e, type AlertSeverity as f, type AlertStatus as g, type AlertType as h, type CipherTextOptions as i, type CipherTextPayload as j, type CipherTextReason as k, type CipherTextResult as l, type ComplianceCheckResponse as m, type CreateGeofenceRuleRequest as n, type CreateJurisdictionRequest as o, type CreateLocationRequestRequest as p, type DashboardMetrics as q, type DecryptedCipherText as r, type DeviceFingerprint as s, type DeviceTrustResult as t, type GeoIPResult as u, type GeofenceAction as v, type GeofenceEvaluation as w, type GeofenceRule as x, type GeofenceRuleType as y, type GeolocationAlert as z };
1078
+ export { type UseLocationCaptureResult as $, type APIError as A, type GeolocationAlert as B, type CipherTextCustomerData as C, type DeviceFingerprintRequest as D, type GeolocationClientConfig as E, type GeolocationConfigResponse as F, GeolocationClient as G, type GeolocationRecord as H, type LocationCaptureRequest as I, type JurisdictionConfig as J, type LocationCaptureResponse as K, type LocationVerification as L, type LocationRequestChannel as M, type LocationRequestResult as N, type LocationRequestStatus as O, type LocationShareInfo as P, type UpdateGeofenceRuleRequest as Q, type ResendLocationRequestRequest as R, type SignalsNonce as S, type UpdateJurisdictionRequest as T, type UpdateDeviceTrustRequest as U, type ValidateCipherTextResponse as V, type UseAlertsOptions as W, type UseAlertsResult as X, type UseGeolocationOptions as Y, type UseGeolocationResult as Z, type UseLocationCaptureOptions as _, type LocationRequest as a, type UseLocationRequestsOptions as a0, type UseLocationRequestsResult as a1, type ValidateCipherTextRequest as a2, type VerifyIPRequest as a3, type LocationRequestFilters as b, type LocationRequestListResponse as c, type AlertFilters as d, type AlertListResponse as e, type AlertSeverity as f, type AlertStatus as g, type AlertType as h, type CipherTextOptions as i, type CipherTextPayload as j, type CipherTextReason as k, type CipherTextResult as l, type ComplianceCheckResponse as m, type CreateGeofenceRuleRequest as n, type CreateJurisdictionRequest as o, type CreateLocationRequestRequest as p, type DashboardMetrics as q, type DecryptedCipherText as r, type DeviceFingerprint as s, type DeviceSignalsEnvelope as t, type DeviceTrustResult as u, type GeoIPResult as v, type GeofenceAction as w, type GeofenceEvaluation as x, type GeofenceRule as y, type GeofenceRuleType as z };
@@ -1,6 +1,6 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-DF7hlMEz.js';
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-BaUekQT8.js';
2
2
  import { RiskProfileClient } from './risk-profile/index.js';
3
- import { V as VesantConfig, R as RequestOptions } from './client-BolQlL5e.js';
3
+ import { V as VesantConfig, R as RequestOptions } from './client-q9fN8Hhf.js';
4
4
  import { C as CustomerProfile } from './types-UGyDl1fd.js';
5
5
  import { E as EntityType, B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.js';
6
6
 
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-BolQlL5e.mjs';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-q9fN8Hhf.mjs';
2
2
  import { B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.mjs';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -47,6 +47,8 @@ interface CipherTextPayload {
47
47
  heading?: number;
48
48
  speed?: number;
49
49
  timestamp: number;
50
+ /** Advisory client-side GPS integrity flags; the server weighs these as risk factors. */
51
+ integrity_flags?: string[];
50
52
  };
51
53
  /** Network information */
52
54
  network?: {
@@ -74,9 +76,12 @@ type CipherTextReason = 'registration' | 'login' | 'transaction' | 'interval_che
74
76
  interface CipherTextOptions {
75
77
  /** Reason for collection (required) */
76
78
  reason: CipherTextReason;
77
- /** Public signing key (pk_) for HMAC signing (produces v02 signed cipherText) */
79
+ /**
80
+ * @deprecated No longer used and ignored; envelope validation is handled by the
81
+ * server. This field will be removed in a future release.
82
+ */
78
83
  signingKey?: string;
79
- /** @deprecated Use signingKey instead. API key for HMAC signing (backward compat) */
84
+ /** @deprecated No longer used and ignored; see signingKey. */
80
85
  apiKey?: string;
81
86
  /** Request GPS location (default: false) */
82
87
  requestLocation?: boolean;
@@ -106,6 +111,11 @@ interface CipherTextResult {
106
111
  /** Expiry time for the cipherText */
107
112
  expiresAt: string;
108
113
  }
114
+ /**
115
+ * Honest name for CipherTextResult: a base64 JSON device-signals envelope
116
+ * (not encryption). Prefer this name; `CipherTextResult` remains as an alias.
117
+ */
118
+ type DeviceSignalsEnvelope = CipherTextResult;
109
119
  /**
110
120
  * Decrypted cipherText data (returned by server after validation)
111
121
  */
@@ -164,6 +174,21 @@ interface ValidateCipherTextRequest {
164
174
  * has complete customer information (name, email, etc.)
165
175
  */
166
176
  customer_data?: CipherTextCustomerData;
177
+ /**
178
+ * Single-use device-signals nonce from {@link SignalsNonce}. Bound to the
179
+ * tenant, user, and event; consumed server-side so the submission can't be
180
+ * replayed. Attached automatically by the client.
181
+ */
182
+ nonce?: string;
183
+ }
184
+ /**
185
+ * A short-lived, single-use device-signals nonce minted by the server. Bind a
186
+ * device-signals submission to a specific tenant, user, and event type so a
187
+ * captured envelope can't be replayed. Integrity is enforced server-side.
188
+ */
189
+ interface SignalsNonce {
190
+ nonce: string;
191
+ expires_at: string;
167
192
  }
168
193
  /**
169
194
  * Response from cipherText validation
@@ -227,7 +252,11 @@ interface ValidateCipherTextResponse {
227
252
  };
228
253
  }
229
254
  interface VerifyIPRequest {
230
- ip_address: string;
255
+ /**
256
+ * Optional. Omit to let the server derive the connecting IP — the SDK never
257
+ * asserts the client IP (spoofable, and the server extracts it authoritatively).
258
+ */
259
+ ip_address?: string;
231
260
  user_id: string;
232
261
  event_type: string;
233
262
  device_fingerprint?: DeviceFingerprintRequest;
@@ -483,7 +512,9 @@ interface GeolocationConfigResponse {
483
512
  };
484
513
  /** When true, GPS-verified location overrides anonymizer-based blocking */
485
514
  trust_gps_over_anonymizer: boolean;
486
- /** Public signing key (pk_) for client-side HMAC signing */
515
+ /**
516
+ * @deprecated No longer used by the SDK and ignored if present.
517
+ */
487
518
  signing_key?: string;
488
519
  }
489
520
  interface GeolocationClientConfig {
@@ -503,6 +534,15 @@ interface GeolocationClientConfig {
503
534
  logger?: Logger;
504
535
  /** Environment mode - 'sandbox' uses isolated sandbox data */
505
536
  environment?: 'production' | 'sandbox';
537
+ /**
538
+ * How long a fetched GPS requirement config is reused before it is read again,
539
+ * in milliseconds (default: 300000, i.e. 5 minutes).
540
+ *
541
+ * These requirements are edited in the compliance console while your
542
+ * application is running, so a lower value makes changes take effect sooner at
543
+ * the cost of more requests. Use `refreshGPSConfig()` to re-read immediately.
544
+ */
545
+ gpsConfigTtlMs?: number;
506
546
  }
507
547
  interface UseGeolocationOptions {
508
548
  /** Auto-detect and verify user's IP on mount */
@@ -624,16 +664,6 @@ interface ResendLocationRequestRequest {
624
664
  email?: string;
625
665
  phone?: string;
626
666
  }
627
- interface WiFiNetwork {
628
- /** MAC address (BSSID) */
629
- macAddress: string;
630
- /** Signal strength in dBm (negative number) */
631
- signalStrength?: number;
632
- /** WiFi channel */
633
- channel?: number;
634
- /** Network name (optional) */
635
- ssid?: string;
636
- }
637
667
  interface LocationCaptureRequest {
638
668
  /** GPS latitude (if available) */
639
669
  latitude?: number;
@@ -641,8 +671,8 @@ interface LocationCaptureRequest {
641
671
  longitude?: number;
642
672
  /** GPS accuracy in meters */
643
673
  accuracy?: number;
644
- /** WiFi networks for positioning (if GPS not available) */
645
- wifi_networks?: WiFiNetwork[];
674
+ /** Advisory client-side GPS integrity flags; the server weighs these as risk factors. */
675
+ integrity_flags?: string[];
646
676
  /** User agent string */
647
677
  user_agent?: string;
648
678
  /** Device metadata */
@@ -662,6 +692,10 @@ interface LocationShareInfo {
662
692
  status: string;
663
693
  is_expired: boolean;
664
694
  is_completed: boolean;
695
+ /**
696
+ * Server-only hint. The web SDK cannot enumerate WiFi networks (no browser API
697
+ * for BSSIDs); this flag is informational and never satisfied client-side.
698
+ */
665
699
  requires_wifi: boolean;
666
700
  }
667
701
  interface LocationCaptureResponse {
@@ -730,8 +764,6 @@ interface UseLocationCaptureOptions {
730
764
  autoFetch?: boolean;
731
765
  /** Auto-request GPS permission on mount */
732
766
  autoRequestGPS?: boolean;
733
- /** Collect WiFi data as fallback (requires explicit permission) */
734
- collectWiFi?: boolean;
735
767
  }
736
768
  interface UseLocationCaptureResult {
737
769
  /** Location share info */
@@ -763,18 +795,9 @@ interface UseLocationCaptureResult {
763
795
  * Extends BaseClient for consistent retry logic, timeout handling, and error management.
764
796
  */
765
797
 
766
- /**
767
- * GeolocationClient extends BaseClient for:
768
- * - Consistent retry logic with exponential backoff
769
- * - Unified error handling (VesantError, NetworkError, TimeoutError, etc.)
770
- * - Automatic timeout management
771
- * - Debug logging
772
- *
773
- * All geolocation verification calls use requestWithRetry() to handle
774
- * transient failures gracefully.
775
- */
776
798
  declare class GeolocationClient extends BaseClient {
777
- private cachedSigningKey?;
799
+ private readonly gpsConfigTtlMs;
800
+ private gpsConfigCache;
778
801
  constructor(config: GeolocationClientConfig);
779
802
  /**
780
803
  * Verify an IP address and check compliance
@@ -836,14 +859,45 @@ declare class GeolocationClient extends BaseClient {
836
859
  */
837
860
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
838
861
  /**
839
- * Fetch the signing key from the dedicated authenticated endpoint.
862
+ * Re-read the tenant's GPS requirement configuration, ignoring any copy held
863
+ * from an earlier read.
864
+ *
865
+ * These requirements are edited in the compliance console while your
866
+ * application is running. `getGPSConfig` reuses a fetched copy for a short
867
+ * period so a long-lived session does not call the API on every event; call
868
+ * this when you need a change to take effect immediately — for example right
869
+ * after an administrator saves new settings.
870
+ *
871
+ * @returns The current GPS requirement config per event type
872
+ *
873
+ * @example
874
+ * ```typescript
875
+ * const config = await client.refreshGPSConfig();
876
+ * if (config.require_gps.login) {
877
+ * // GPS is now required for login
878
+ * }
879
+ * ```
880
+ */
881
+ refreshGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
882
+ /**
883
+ * Mint a short-lived, single-use device-signals nonce.
840
884
  *
841
- * Falls back to getGPSConfig() for backward compatibility with older servers
842
- * that don't expose `/api/v1/geo/signing-key`.
885
+ * The nonce is bound to the tenant, user, and event type and is consumed
886
+ * server-side during validation, so a captured device-signals envelope cannot
887
+ * be replayed. `validateCipherText` mints and attaches one automatically; call
888
+ * this directly only if you manage the nonce yourself.
843
889
  *
844
- * @returns The signing key string, or undefined if unavailable
890
+ * @param userId - User ID the nonce is bound to
891
+ * @param eventType - Event type the nonce is bound to (login, registration, ...)
892
+ * @returns The nonce and its expiry
893
+ */
894
+ fetchSignalsNonce(userId: string, eventType: CipherTextReason, requestOptions?: RequestOptions): Promise<SignalsNonce>;
895
+ /**
896
+ * Best-effort nonce mint for validation. Returns undefined if minting fails —
897
+ * the server is the sole authority and blocks when a nonce is required, so this
898
+ * never downgrades security on the client's say-so.
845
899
  */
846
- fetchSigningKey(requestOptions?: RequestOptions): Promise<string | undefined>;
900
+ private resolveSignalsNonce;
847
901
  /**
848
902
  * Validate a cipherText generated by the frontend SDK
849
903
  *
@@ -995,40 +1049,30 @@ declare class GeolocationClient extends BaseClient {
995
1049
  *
996
1050
  * @example
997
1051
  * ```typescript
998
- * // Using GPS (preferred)
1052
+ * // GPS (the web SDK is GPS + IP only; the server handles the IP fallback)
999
1053
  * const result = await client.captureLocation(token, {
1000
1054
  * latitude: 37.7749,
1001
1055
  * longitude: -122.4194,
1002
1056
  * accuracy: 10
1003
1057
  * });
1004
- *
1005
- * // Using WiFi positioning (fallback)
1006
- * const result = await client.captureLocation(token, {
1007
- * wifi_networks: [
1008
- * { macAddress: "00:11:22:33:44:55", signalStrength: -50 },
1009
- * { macAddress: "AA:BB:CC:DD:EE:FF", signalStrength: -70 }
1010
- * ]
1011
- * });
1012
1058
  * ```
1013
1059
  */
1014
1060
  captureLocation(token: string, capture: LocationCaptureRequest, requestOptions?: RequestOptions): Promise<LocationCaptureResponse>;
1015
1061
  /**
1016
- * Generate a signed cipherText containing device and location data.
1017
- *
1018
- * Automatically passes the client's API key for HMAC signing (v02 format).
1019
- * If no API key is configured, falls back to unsigned v01 format.
1062
+ * Generate a device-signals envelope containing device and location data,
1063
+ * validated by the server.
1020
1064
  *
1021
- * @param options - Options for cipherText generation
1065
+ * @param options - Options for envelope generation
1022
1066
  * @param gpsConfig - Optional GPS config (from getGPSConfig)
1023
- * @returns CipherText result with the signed string
1067
+ * @returns The device-signals envelope result
1024
1068
  *
1025
1069
  * @example
1026
1070
  * ```typescript
1027
1071
  * const result = await client.generateCipherText({ reason: 'login' });
1028
- * console.log(result.cipherText); // v02 signed cipherText
1072
+ * console.log(result.cipherText); // device-signals envelope
1029
1073
  * ```
1030
1074
  */
1031
1075
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1032
1076
  }
1033
1077
 
1034
- export { type UseLocationRequestsResult as $, type APIError as A, type GeolocationClientConfig as B, type CipherTextCustomerData as C, type DeviceFingerprintRequest as D, type GeolocationConfigResponse as E, type GeolocationRecord as F, GeolocationClient as G, type LocationCaptureRequest as H, type LocationCaptureResponse as I, type JurisdictionConfig as J, type LocationRequestChannel as K, type LocationVerification as L, type LocationRequestResult as M, type LocationRequestStatus as N, type LocationShareInfo as O, type UpdateGeofenceRuleRequest as P, type UpdateJurisdictionRequest as Q, type ResendLocationRequestRequest as R, type UseAlertsOptions as S, type UseAlertsResult as T, type UpdateDeviceTrustRequest as U, type ValidateCipherTextResponse as V, type UseGeolocationOptions as W, type UseGeolocationResult as X, type UseLocationCaptureOptions as Y, type UseLocationCaptureResult as Z, type UseLocationRequestsOptions as _, type LocationRequest as a, type ValidateCipherTextRequest as a0, type VerifyIPRequest as a1, type WiFiNetwork as a2, type LocationRequestFilters as b, type LocationRequestListResponse as c, type AlertFilters as d, type AlertListResponse as e, type AlertSeverity as f, type AlertStatus as g, type AlertType as h, type CipherTextOptions as i, type CipherTextPayload as j, type CipherTextReason as k, type CipherTextResult as l, type ComplianceCheckResponse as m, type CreateGeofenceRuleRequest as n, type CreateJurisdictionRequest as o, type CreateLocationRequestRequest as p, type DashboardMetrics as q, type DecryptedCipherText as r, type DeviceFingerprint as s, type DeviceTrustResult as t, type GeoIPResult as u, type GeofenceAction as v, type GeofenceEvaluation as w, type GeofenceRule as x, type GeofenceRuleType as y, type GeolocationAlert as z };
1078
+ export { type UseLocationCaptureResult as $, type APIError as A, type GeolocationAlert as B, type CipherTextCustomerData as C, type DeviceFingerprintRequest as D, type GeolocationClientConfig as E, type GeolocationConfigResponse as F, GeolocationClient as G, type GeolocationRecord as H, type LocationCaptureRequest as I, type JurisdictionConfig as J, type LocationCaptureResponse as K, type LocationVerification as L, type LocationRequestChannel as M, type LocationRequestResult as N, type LocationRequestStatus as O, type LocationShareInfo as P, type UpdateGeofenceRuleRequest as Q, type ResendLocationRequestRequest as R, type SignalsNonce as S, type UpdateJurisdictionRequest as T, type UpdateDeviceTrustRequest as U, type ValidateCipherTextResponse as V, type UseAlertsOptions as W, type UseAlertsResult as X, type UseGeolocationOptions as Y, type UseGeolocationResult as Z, type UseLocationCaptureOptions as _, type LocationRequest as a, type UseLocationRequestsOptions as a0, type UseLocationRequestsResult as a1, type ValidateCipherTextRequest as a2, type VerifyIPRequest as a3, type LocationRequestFilters as b, type LocationRequestListResponse as c, type AlertFilters as d, type AlertListResponse as e, type AlertSeverity as f, type AlertStatus as g, type AlertType as h, type CipherTextOptions as i, type CipherTextPayload as j, type CipherTextReason as k, type CipherTextResult as l, type ComplianceCheckResponse as m, type CreateGeofenceRuleRequest as n, type CreateJurisdictionRequest as o, type CreateLocationRequestRequest as p, type DashboardMetrics as q, type DecryptedCipherText as r, type DeviceFingerprint as s, type DeviceSignalsEnvelope as t, type DeviceTrustResult as u, type GeoIPResult as v, type GeofenceAction as w, type GeofenceEvaluation as x, type GeofenceRule as y, type GeofenceRuleType as z };