vesant-sdk 1.4.0 → 1.4.2

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 (61) hide show
  1. package/dist/{client-DoczGA6L.d.ts → client-BlAt791q.d.ts} +12 -1
  2. package/dist/{client-DzElM7u-.d.mts → client-CY41e2Z_.d.mts} +4 -8
  3. package/dist/{client-DzElM7u-.d.ts → client-CY41e2Z_.d.ts} +4 -8
  4. package/dist/{client-B6fUFAUM.d.mts → client-oo_3-0YW.d.mts} +12 -1
  5. package/dist/compliance/index.d.mts +3 -3
  6. package/dist/compliance/index.d.ts +3 -3
  7. package/dist/compliance/index.js +34 -16
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +34 -16
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/decisions/index.d.mts +1 -1
  12. package/dist/decisions/index.d.ts +1 -1
  13. package/dist/decisions/index.js +2 -10
  14. package/dist/decisions/index.js.map +1 -1
  15. package/dist/decisions/index.mjs +2 -10
  16. package/dist/decisions/index.mjs.map +1 -1
  17. package/dist/geolocation/index.d.mts +3 -3
  18. package/dist/geolocation/index.d.ts +3 -3
  19. package/dist/geolocation/index.js +34 -16
  20. package/dist/geolocation/index.js.map +1 -1
  21. package/dist/geolocation/index.mjs +34 -16
  22. package/dist/geolocation/index.mjs.map +1 -1
  23. package/dist/index.d.mts +4 -4
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +36 -17
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +36 -17
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/kyc/core.d.mts +1 -1
  30. package/dist/kyc/core.d.ts +1 -1
  31. package/dist/kyc/core.js +4 -11
  32. package/dist/kyc/core.js.map +1 -1
  33. package/dist/kyc/core.mjs +4 -11
  34. package/dist/kyc/core.mjs.map +1 -1
  35. package/dist/kyc/index.d.mts +3 -1
  36. package/dist/kyc/index.d.ts +3 -1
  37. package/dist/kyc/index.js +4 -11
  38. package/dist/kyc/index.js.map +1 -1
  39. package/dist/kyc/index.mjs +4 -11
  40. package/dist/kyc/index.mjs.map +1 -1
  41. package/dist/react.d.mts +2 -2
  42. package/dist/react.d.ts +2 -2
  43. package/dist/react.js +1 -1
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +1 -1
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/risk-profile/index.d.mts +1 -1
  48. package/dist/risk-profile/index.d.ts +1 -1
  49. package/dist/risk-profile/index.js +2 -10
  50. package/dist/risk-profile/index.js.map +1 -1
  51. package/dist/risk-profile/index.mjs +2 -10
  52. package/dist/risk-profile/index.mjs.map +1 -1
  53. package/dist/scores/index.d.mts +1 -1
  54. package/dist/scores/index.d.ts +1 -1
  55. package/dist/scores/index.js +2 -10
  56. package/dist/scores/index.js.map +1 -1
  57. package/dist/scores/index.mjs +2 -10
  58. package/dist/scores/index.mjs.map +1 -1
  59. package/dist/webhooks/index.d.mts +1 -0
  60. package/dist/webhooks/index.d.ts +1 -0
  61. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -239,7 +239,7 @@ var noopLogger = {
239
239
  };
240
240
 
241
241
  // src/core/version.ts
242
- var SDK_VERSION = "1.4.0";
242
+ var SDK_VERSION = "1.4.1";
243
243
 
244
244
  // src/shared/browser-utils.ts
245
245
  function generateUUID() {
@@ -333,12 +333,6 @@ var BaseClient = class {
333
333
  interceptors: this.interceptors,
334
334
  logger: this.logger
335
335
  };
336
- if (this.config.environment === "sandbox" && this.config.apiKey?.startsWith("pk_live_")) {
337
- this.logger.warn("Production API key used with sandbox environment. Use your sandbox API key (sk_sandbox_) instead.");
338
- }
339
- if (this.config.environment !== "sandbox" && this.config.apiKey?.startsWith("sk_sandbox_")) {
340
- this.logger.warn("Sandbox API key used with production environment. Use your production API key (pk_live_) instead.");
341
- }
342
336
  if (config.circuitBreaker) {
343
337
  this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
344
338
  }
@@ -362,9 +356,7 @@ var BaseClient = class {
362
356
  error.requestId = requestId;
363
357
  throw error;
364
358
  }
365
- const DEFAULT_SANDBOX_URL = "https://sandbox-api.vesant.ai";
366
- const resolvedBaseURL = this.config.environment === "sandbox" ? this.config.sandboxBaseURL || DEFAULT_SANDBOX_URL : serviceURL || this.config.baseURL;
367
- const url = `${serviceURL || resolvedBaseURL}${endpoint}`;
359
+ const url = `${serviceURL || this.config.baseURL}${endpoint}`;
368
360
  const headers = {
369
361
  "Content-Type": "application/json",
370
362
  "X-Tenant-ID": this.config.tenantId,
@@ -876,7 +868,8 @@ var GeolocationClient = class extends BaseClient {
876
868
  retries: 3,
877
869
  // Default retry count for geolocation calls
878
870
  debug: config.debug,
879
- logger: config.logger
871
+ logger: config.logger,
872
+ environment: config.environment
880
873
  };
881
874
  super(baseConfig);
882
875
  }
@@ -970,6 +963,32 @@ var GeolocationClient = class extends BaseClient {
970
963
  }
971
964
  return config;
972
965
  }
966
+ /**
967
+ * Fetch the signing key from the dedicated authenticated endpoint.
968
+ *
969
+ * Falls back to getGPSConfig() for backward compatibility with older servers
970
+ * that don't expose `/api/v1/geo/signing-key`.
971
+ *
972
+ * @returns The signing key string, or undefined if unavailable
973
+ */
974
+ async fetchSigningKey(requestOptions) {
975
+ try {
976
+ const response = await this.requestWithRetry(
977
+ "/api/v1/geo/signing-key",
978
+ void 0,
979
+ void 0,
980
+ void 0,
981
+ requestOptions
982
+ );
983
+ if (response.signing_key) {
984
+ this.cachedSigningKey = response.signing_key;
985
+ return response.signing_key;
986
+ }
987
+ } catch {
988
+ }
989
+ const config = await this.getGPSConfig(requestOptions);
990
+ return config.signing_key;
991
+ }
973
992
  // ============================================================================
974
993
  // CipherText Validation
975
994
  // ============================================================================
@@ -1250,11 +1269,10 @@ var GeolocationClient = class extends BaseClient {
1250
1269
  let signingKey = this.cachedSigningKey;
1251
1270
  let resolvedGpsConfig = gpsConfig;
1252
1271
  if (!signingKey) {
1253
- const config = await this.getGPSConfig();
1254
- signingKey = config.signing_key;
1255
- if (!resolvedGpsConfig) {
1256
- resolvedGpsConfig = config;
1257
- }
1272
+ signingKey = await this.fetchSigningKey();
1273
+ }
1274
+ if (!resolvedGpsConfig) {
1275
+ resolvedGpsConfig = await this.getGPSConfig();
1258
1276
  }
1259
1277
  return generateCipherText(
1260
1278
  { ...options, signingKey: signingKey || void 0 },
@@ -2254,7 +2272,8 @@ var KycClient = class extends BaseClient {
2254
2272
  timeout: config.timeout,
2255
2273
  retries: 3,
2256
2274
  // Default retry count for KYC calls
2257
- debug: config.debug
2275
+ debug: config.debug,
2276
+ environment: config.environment
2258
2277
  };
2259
2278
  super(baseConfig);
2260
2279
  this.userId = config.userId;