vesant-sdk 1.7.1-dev.ec505dc → 1.7.1-dev.fe54858

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 (41) hide show
  1. package/dist/{client-BY4Quazn.d.ts → client-B3DCAHlg.d.ts} +1 -1
  2. package/dist/{client-Yxat9wAO.d.mts → client-BwXMQA2a.d.mts} +35 -1
  3. package/dist/{client-CX1jcLNZ.d.mts → client-D23KhWeh.d.mts} +1 -1
  4. package/dist/{client-C-u9lE8N.d.ts → client-fy3trF2K.d.ts} +35 -1
  5. package/dist/compliance/index.d.mts +2 -2
  6. package/dist/compliance/index.d.ts +2 -2
  7. package/dist/compliance/index.js +46 -1
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +46 -1
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/geolocation/index.d.mts +2 -2
  12. package/dist/geolocation/index.d.ts +2 -2
  13. package/dist/geolocation/index.js +46 -1
  14. package/dist/geolocation/index.js.map +1 -1
  15. package/dist/geolocation/index.mjs +46 -1
  16. package/dist/geolocation/index.mjs.map +1 -1
  17. package/dist/index.d.mts +3 -3
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +50 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +50 -2
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/kyc/core.d.mts +1 -1
  24. package/dist/kyc/core.d.ts +1 -1
  25. package/dist/kyc/core.js +4 -0
  26. package/dist/kyc/core.js.map +1 -1
  27. package/dist/kyc/core.mjs +4 -1
  28. package/dist/kyc/core.mjs.map +1 -1
  29. package/dist/kyc/index.d.mts +122 -16
  30. package/dist/kyc/index.d.ts +122 -16
  31. package/dist/kyc/index.js +4 -0
  32. package/dist/kyc/index.js.map +1 -1
  33. package/dist/kyc/index.mjs +4 -1
  34. package/dist/kyc/index.mjs.map +1 -1
  35. package/dist/react.d.mts +2 -2
  36. package/dist/react.d.ts +2 -2
  37. package/dist/react.js +3 -0
  38. package/dist/react.js.map +1 -1
  39. package/dist/react.mjs +3 -0
  40. package/dist/react.mjs.map +1 -1
  41. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1204,6 +1204,49 @@ var GeolocationClient = class extends BaseClient {
1204
1204
  async getGPSConfig(requestOptions) {
1205
1205
  return this.requestWithRetry("/api/v1/geo/config", void 0, void 0, void 0, requestOptions);
1206
1206
  }
1207
+ /**
1208
+ * Mint a short-lived, single-use device-signals nonce.
1209
+ *
1210
+ * The nonce is bound to the tenant, user, and event type and is consumed
1211
+ * server-side during validation, so a captured device-signals envelope cannot
1212
+ * be replayed. `validateCipherText` mints and attaches one automatically; call
1213
+ * this directly only if you manage the nonce yourself.
1214
+ *
1215
+ * @param userId - User ID the nonce is bound to
1216
+ * @param eventType - Event type the nonce is bound to (login, registration, ...)
1217
+ * @returns The nonce and its expiry
1218
+ */
1219
+ async fetchSignalsNonce(userId, eventType, requestOptions) {
1220
+ if (!userId?.trim()) {
1221
+ throw new ValidationError("userId is required and must be a non-empty string", ["userId"]);
1222
+ }
1223
+ const request = { user_id: userId, event_type: eventType };
1224
+ return this.request(
1225
+ "/api/v1/geo/signals-token",
1226
+ {
1227
+ method: "POST",
1228
+ body: JSON.stringify(request)
1229
+ },
1230
+ void 0,
1231
+ requestOptions
1232
+ );
1233
+ }
1234
+ /**
1235
+ * Best-effort nonce mint for validation. Returns undefined if minting fails —
1236
+ * the server is the sole authority and blocks when a nonce is required, so this
1237
+ * never downgrades security on the client's say-so.
1238
+ */
1239
+ async resolveSignalsNonce(userId, eventType, requestOptions) {
1240
+ try {
1241
+ const { nonce } = await this.fetchSignalsNonce(userId, eventType, requestOptions);
1242
+ return nonce;
1243
+ } catch (err) {
1244
+ this.logger.warn(
1245
+ `Failed to mint device-signals nonce; proceeding without it: ${err instanceof Error ? err.message : String(err)}`
1246
+ );
1247
+ return void 0;
1248
+ }
1249
+ }
1207
1250
  // ============================================================================
1208
1251
  // CipherText Validation
1209
1252
  // ============================================================================
@@ -1255,12 +1298,14 @@ var GeolocationClient = class extends BaseClient {
1255
1298
  if (!userId?.trim()) {
1256
1299
  throw new ValidationError("userId is required and must be a non-empty string", ["userId"]);
1257
1300
  }
1301
+ const nonce = await this.resolveSignalsNonce(userId, eventType, requestOptions);
1258
1302
  const request = {
1259
1303
  cipher_text: cipherText,
1260
1304
  user_id: userId,
1261
1305
  event_type: eventType,
1262
1306
  expected_ip: expectedIP,
1263
- customer_data: customerData
1307
+ customer_data: customerData,
1308
+ nonce
1264
1309
  };
1265
1310
  return this.requestWithRetry(
1266
1311
  "/api/v1/geo/validate-ciphertext",
@@ -3479,6 +3524,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
3479
3524
  KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
3480
3525
  KYC_DECLINED: "Identity verification was declined"
3481
3526
  };
3527
+ function isKycDocumentExpiredCallbackEvent(value) {
3528
+ return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
3529
+ }
3482
3530
 
3483
3531
  // src/tax/client.ts
3484
3532
  var TaxClient = class extends BaseClient {
@@ -3768,6 +3816,6 @@ function buildHandler(options) {
3768
3816
  return handler;
3769
3817
  }
3770
3818
 
3771
- export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, InMemoryDedupStore, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, collectAll, collectDeviceSignals, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isCipherTextExpired, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
3819
+ export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, InMemoryDedupStore, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, collectAll, collectDeviceSignals, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isCipherTextExpired, isKycDocumentExpiredCallbackEvent, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
3772
3820
  //# sourceMappingURL=index.mjs.map
3773
3821
  //# sourceMappingURL=index.mjs.map