vesant-sdk 1.7.1-dev.ec505dc → 1.7.2-dev.5ca1247

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 (53) 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 +47 -2
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +47 -2
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/decisions/index.js +1 -1
  12. package/dist/decisions/index.js.map +1 -1
  13. package/dist/decisions/index.mjs +1 -1
  14. package/dist/decisions/index.mjs.map +1 -1
  15. package/dist/geolocation/index.d.mts +2 -2
  16. package/dist/geolocation/index.d.ts +2 -2
  17. package/dist/geolocation/index.js +47 -2
  18. package/dist/geolocation/index.js.map +1 -1
  19. package/dist/geolocation/index.mjs +47 -2
  20. package/dist/geolocation/index.mjs.map +1 -1
  21. package/dist/index.d.mts +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +47 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +47 -2
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/kyc/core.js +1 -1
  28. package/dist/kyc/core.js.map +1 -1
  29. package/dist/kyc/core.mjs +1 -1
  30. package/dist/kyc/core.mjs.map +1 -1
  31. package/dist/kyc/index.js +1 -1
  32. package/dist/kyc/index.js.map +1 -1
  33. package/dist/kyc/index.mjs +1 -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 +1 -1
  38. package/dist/react.js.map +1 -1
  39. package/dist/react.mjs +1 -1
  40. package/dist/react.mjs.map +1 -1
  41. package/dist/risk-profile/index.js +1 -1
  42. package/dist/risk-profile/index.js.map +1 -1
  43. package/dist/risk-profile/index.mjs +1 -1
  44. package/dist/risk-profile/index.mjs.map +1 -1
  45. package/dist/scores/index.js +1 -1
  46. package/dist/scores/index.js.map +1 -1
  47. package/dist/scores/index.mjs +1 -1
  48. package/dist/scores/index.mjs.map +1 -1
  49. package/dist/tax/index.js +1 -1
  50. package/dist/tax/index.js.map +1 -1
  51. package/dist/tax/index.mjs +1 -1
  52. package/dist/tax/index.mjs.map +1 -1
  53. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -296,7 +296,7 @@ var noopLogger = {
296
296
  };
297
297
 
298
298
  // src/core/version.ts
299
- var SDK_VERSION = "1.7.1";
299
+ var SDK_VERSION = "1.7.2";
300
300
 
301
301
  // src/shared/browser-utils.ts
302
302
  function generateUUID() {
@@ -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",