vesant-sdk 1.7.1-dev.ec505dc → 1.7.1-next.4e2ab61

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.
@@ -1,4 +1,4 @@
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-C-u9lE8N.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-fy3trF2K.js';
2
2
  import { RiskProfileClient } from './risk-profile/index.js';
3
3
  import { V as VesantConfig, R as RequestOptions } from './client-q9fN8Hhf.js';
4
4
  import { C as CustomerProfile } from './types-UGyDl1fd.js';
@@ -174,6 +174,21 @@ interface ValidateCipherTextRequest {
174
174
  * has complete customer information (name, email, etc.)
175
175
  */
176
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;
177
192
  }
178
193
  /**
179
194
  * Response from cipherText validation
@@ -842,6 +857,25 @@ declare class GeolocationClient extends BaseClient {
842
857
  * ```
843
858
  */
844
859
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
860
+ /**
861
+ * Mint a short-lived, single-use device-signals nonce.
862
+ *
863
+ * The nonce is bound to the tenant, user, and event type and is consumed
864
+ * server-side during validation, so a captured device-signals envelope cannot
865
+ * be replayed. `validateCipherText` mints and attaches one automatically; call
866
+ * this directly only if you manage the nonce yourself.
867
+ *
868
+ * @param userId - User ID the nonce is bound to
869
+ * @param eventType - Event type the nonce is bound to (login, registration, ...)
870
+ * @returns The nonce and its expiry
871
+ */
872
+ fetchSignalsNonce(userId: string, eventType: CipherTextReason, requestOptions?: RequestOptions): Promise<SignalsNonce>;
873
+ /**
874
+ * Best-effort nonce mint for validation. Returns undefined if minting fails —
875
+ * the server is the sole authority and blocks when a nonce is required, so this
876
+ * never downgrades security on the client's say-so.
877
+ */
878
+ private resolveSignalsNonce;
845
879
  /**
846
880
  * Validate a cipherText generated by the frontend SDK
847
881
  *
@@ -1019,4 +1053,4 @@ declare class GeolocationClient extends BaseClient {
1019
1053
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1020
1054
  }
1021
1055
 
1022
- export { type UseLocationRequestsOptions 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 UpdateJurisdictionRequest as S, type UseAlertsOptions as T, type UpdateDeviceTrustRequest as U, type ValidateCipherTextResponse as V, type UseAlertsResult as W, type UseGeolocationOptions as X, type UseGeolocationResult as Y, type UseLocationCaptureOptions as Z, type UseLocationCaptureResult as _, type LocationRequest as a, type UseLocationRequestsResult as a0, type ValidateCipherTextRequest as a1, type VerifyIPRequest 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 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 };
1056
+ 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,4 +1,4 @@
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-Yxat9wAO.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-BwXMQA2a.mjs';
2
2
  import { RiskProfileClient } from './risk-profile/index.mjs';
3
3
  import { V as VesantConfig, R as RequestOptions } from './client-q9fN8Hhf.mjs';
4
4
  import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
@@ -174,6 +174,21 @@ interface ValidateCipherTextRequest {
174
174
  * has complete customer information (name, email, etc.)
175
175
  */
176
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;
177
192
  }
178
193
  /**
179
194
  * Response from cipherText validation
@@ -842,6 +857,25 @@ declare class GeolocationClient extends BaseClient {
842
857
  * ```
843
858
  */
844
859
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
860
+ /**
861
+ * Mint a short-lived, single-use device-signals nonce.
862
+ *
863
+ * The nonce is bound to the tenant, user, and event type and is consumed
864
+ * server-side during validation, so a captured device-signals envelope cannot
865
+ * be replayed. `validateCipherText` mints and attaches one automatically; call
866
+ * this directly only if you manage the nonce yourself.
867
+ *
868
+ * @param userId - User ID the nonce is bound to
869
+ * @param eventType - Event type the nonce is bound to (login, registration, ...)
870
+ * @returns The nonce and its expiry
871
+ */
872
+ fetchSignalsNonce(userId: string, eventType: CipherTextReason, requestOptions?: RequestOptions): Promise<SignalsNonce>;
873
+ /**
874
+ * Best-effort nonce mint for validation. Returns undefined if minting fails —
875
+ * the server is the sole authority and blocks when a nonce is required, so this
876
+ * never downgrades security on the client's say-so.
877
+ */
878
+ private resolveSignalsNonce;
845
879
  /**
846
880
  * Validate a cipherText generated by the frontend SDK
847
881
  *
@@ -1019,4 +1053,4 @@ declare class GeolocationClient extends BaseClient {
1019
1053
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1020
1054
  }
1021
1055
 
1022
- export { type UseLocationRequestsOptions 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 UpdateJurisdictionRequest as S, type UseAlertsOptions as T, type UpdateDeviceTrustRequest as U, type ValidateCipherTextResponse as V, type UseAlertsResult as W, type UseGeolocationOptions as X, type UseGeolocationResult as Y, type UseLocationCaptureOptions as Z, type UseLocationCaptureResult as _, type LocationRequest as a, type UseLocationRequestsResult as a0, type ValidateCipherTextRequest as a1, type VerifyIPRequest 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 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 };
1056
+ 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
1
  import { B as BlockReason } from '../types-CBQRNL-l.mjs';
2
- export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-CX1jcLNZ.mjs';
3
- export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-Yxat9wAO.mjs';
2
+ export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-D23KhWeh.mjs';
3
+ export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-BwXMQA2a.mjs';
4
4
  import '../risk-profile/index.mjs';
5
5
  import '../client-q9fN8Hhf.mjs';
6
6
  import '../types-BOFaMQxI.mjs';
@@ -1,6 +1,6 @@
1
1
  import { B as BlockReason } from '../types-CBQRNL-l.js';
2
- export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-BY4Quazn.js';
3
- export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-C-u9lE8N.js';
2
+ export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-B3DCAHlg.js';
3
+ export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-fy3trF2K.js';
4
4
  import '../risk-profile/index.js';
5
5
  import '../client-q9fN8Hhf.js';
6
6
  import '../types-UGyDl1fd.js';
@@ -1071,6 +1071,49 @@ var GeolocationClient = class extends BaseClient {
1071
1071
  async getGPSConfig(requestOptions) {
1072
1072
  return this.requestWithRetry("/api/v1/geo/config", void 0, void 0, void 0, requestOptions);
1073
1073
  }
1074
+ /**
1075
+ * Mint a short-lived, single-use device-signals nonce.
1076
+ *
1077
+ * The nonce is bound to the tenant, user, and event type and is consumed
1078
+ * server-side during validation, so a captured device-signals envelope cannot
1079
+ * be replayed. `validateCipherText` mints and attaches one automatically; call
1080
+ * this directly only if you manage the nonce yourself.
1081
+ *
1082
+ * @param userId - User ID the nonce is bound to
1083
+ * @param eventType - Event type the nonce is bound to (login, registration, ...)
1084
+ * @returns The nonce and its expiry
1085
+ */
1086
+ async fetchSignalsNonce(userId, eventType, requestOptions) {
1087
+ if (!userId?.trim()) {
1088
+ throw new ValidationError("userId is required and must be a non-empty string", ["userId"]);
1089
+ }
1090
+ const request = { user_id: userId, event_type: eventType };
1091
+ return this.request(
1092
+ "/api/v1/geo/signals-token",
1093
+ {
1094
+ method: "POST",
1095
+ body: JSON.stringify(request)
1096
+ },
1097
+ void 0,
1098
+ requestOptions
1099
+ );
1100
+ }
1101
+ /**
1102
+ * Best-effort nonce mint for validation. Returns undefined if minting fails —
1103
+ * the server is the sole authority and blocks when a nonce is required, so this
1104
+ * never downgrades security on the client's say-so.
1105
+ */
1106
+ async resolveSignalsNonce(userId, eventType, requestOptions) {
1107
+ try {
1108
+ const { nonce } = await this.fetchSignalsNonce(userId, eventType, requestOptions);
1109
+ return nonce;
1110
+ } catch (err) {
1111
+ this.logger.warn(
1112
+ `Failed to mint device-signals nonce; proceeding without it: ${err instanceof Error ? err.message : String(err)}`
1113
+ );
1114
+ return void 0;
1115
+ }
1116
+ }
1074
1117
  // ============================================================================
1075
1118
  // CipherText Validation
1076
1119
  // ============================================================================
@@ -1122,12 +1165,14 @@ var GeolocationClient = class extends BaseClient {
1122
1165
  if (!userId?.trim()) {
1123
1166
  throw new ValidationError("userId is required and must be a non-empty string", ["userId"]);
1124
1167
  }
1168
+ const nonce = await this.resolveSignalsNonce(userId, eventType, requestOptions);
1125
1169
  const request = {
1126
1170
  cipher_text: cipherText,
1127
1171
  user_id: userId,
1128
1172
  event_type: eventType,
1129
1173
  expected_ip: expectedIP,
1130
- customer_data: customerData
1174
+ customer_data: customerData,
1175
+ nonce
1131
1176
  };
1132
1177
  return this.requestWithRetry(
1133
1178
  "/api/v1/geo/validate-ciphertext",