vesant-sdk 1.7.0-dev.b2c9ecf → 1.7.0-dev.b4284ca

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-B32yBt1b.d.ts → client-0NOPDnT0.d.ts} +16 -26
  2. package/dist/{client-BqPVh5jH.d.mts → client-CvWNRwwg.d.mts} +16 -26
  3. package/dist/{client-CHPEgasE.d.mts → client-Dps40EtF.d.mts} +2 -2
  4. package/dist/{client-pKE_gii_.d.ts → client-SMxqod4j.d.ts} +2 -2
  5. package/dist/{client-6sSaxufk.d.mts → client-q9fN8Hhf.d.mts} +96 -1
  6. package/dist/{client-6sSaxufk.d.ts → client-q9fN8Hhf.d.ts} +96 -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 +114 -16
  10. package/dist/compliance/index.js.map +1 -1
  11. package/dist/compliance/index.mjs +114 -16
  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 +49 -4
  16. package/dist/decisions/index.js.map +1 -1
  17. package/dist/decisions/index.mjs +49 -4
  18. package/dist/decisions/index.mjs.map +1 -1
  19. package/dist/geolocation/index.d.mts +59 -4
  20. package/dist/geolocation/index.d.ts +59 -4
  21. package/dist/geolocation/index.js +117 -16
  22. package/dist/geolocation/index.js.map +1 -1
  23. package/dist/geolocation/index.mjs +115 -17
  24. package/dist/geolocation/index.mjs.map +1 -1
  25. package/dist/index-CPOrMRaH.d.ts +264 -0
  26. package/dist/index-CimDmgZb.d.mts +264 -0
  27. package/dist/index.d.mts +25 -8
  28. package/dist/index.d.ts +25 -8
  29. package/dist/index.js +274 -37
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +267 -38
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/kyc/core.d.mts +1 -1
  34. package/dist/kyc/core.d.ts +1 -1
  35. package/dist/kyc/core.js +49 -4
  36. package/dist/kyc/core.js.map +1 -1
  37. package/dist/kyc/core.mjs +49 -4
  38. package/dist/kyc/core.mjs.map +1 -1
  39. package/dist/kyc/index.d.mts +1 -1
  40. package/dist/kyc/index.d.ts +1 -1
  41. package/dist/kyc/index.js +49 -4
  42. package/dist/kyc/index.js.map +1 -1
  43. package/dist/kyc/index.mjs +49 -4
  44. package/dist/kyc/index.mjs.map +1 -1
  45. package/dist/react.d.mts +7 -3
  46. package/dist/react.d.ts +7 -3
  47. package/dist/react.js +68 -4
  48. package/dist/react.js.map +1 -1
  49. package/dist/react.mjs +68 -4
  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 +49 -4
  54. package/dist/risk-profile/index.js.map +1 -1
  55. package/dist/risk-profile/index.mjs +49 -4
  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 +49 -4
  60. package/dist/scores/index.js.map +1 -1
  61. package/dist/scores/index.mjs +49 -4
  62. package/dist/scores/index.mjs.map +1 -1
  63. package/dist/tax/index.d.mts +1 -1
  64. package/dist/tax/index.d.ts +1 -1
  65. package/dist/tax/index.js +49 -4
  66. package/dist/tax/index.js.map +1 -1
  67. package/dist/tax/index.mjs +49 -4
  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
package/dist/react.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult } from './client-BqPVh5jH.mjs';
2
- import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-CHPEgasE.mjs';
1
+ import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult } from './client-CvWNRwwg.mjs';
2
+ import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-Dps40EtF.mjs';
3
3
  import { RiskProfileClient } from './risk-profile/index.mjs';
4
4
  import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
5
5
  import { KycClient, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.mjs';
6
- import './client-6sSaxufk.mjs';
6
+ import './client-q9fN8Hhf.mjs';
7
7
  import './types-CBQRNL-l.mjs';
8
8
 
9
9
  /**
@@ -21,6 +21,10 @@ declare function getBrowserInfo(): {
21
21
  * React Hooks for Vesant Geolocation SDK
22
22
  *
23
23
  * Provides convenient React hooks for using the geolocation service in Next.js applications.
24
+ *
25
+ * Scope: the web SDK collects GPS + IP only (no WiFi/cell positioning — no browser
26
+ * API exists). The client never asserts its own IP; the server derives it. GPS
27
+ * fixes are run through advisory in-browser integrity heuristics (see ./integrity).
24
28
  */
25
29
 
26
30
  /**
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult } from './client-B32yBt1b.js';
2
- import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-pKE_gii_.js';
1
+ import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult } from './client-0NOPDnT0.js';
2
+ import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-SMxqod4j.js';
3
3
  import { RiskProfileClient } from './risk-profile/index.js';
4
4
  import { C as CustomerProfile } from './types-UGyDl1fd.js';
5
5
  import { KycClient, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.js';
6
- import './client-6sSaxufk.js';
6
+ import './client-q9fN8Hhf.js';
7
7
  import './types-CBQRNL-l.js';
8
8
 
9
9
  /**
@@ -21,6 +21,10 @@ declare function getBrowserInfo(): {
21
21
  * React Hooks for Vesant Geolocation SDK
22
22
  *
23
23
  * Provides convenient React hooks for using the geolocation service in Next.js applications.
24
+ *
25
+ * Scope: the web SDK collects GPS + IP only (no WiFi/cell positioning — no browser
26
+ * API exists). The client never asserts its own IP; the server derives it. GPS
27
+ * fixes are run through advisory in-browser integrity heuristics (see ./integrity).
24
28
  */
25
29
 
26
30
  /**
package/dist/react.js CHANGED
@@ -93,6 +93,61 @@ function getBrowserInfo() {
93
93
  return { browser, browser_version: browserVersion, os, os_version: osVersion };
94
94
  }
95
95
 
96
+ // src/geolocation/integrity.ts
97
+ var isNil = (v) => v === null || v === void 0;
98
+ function assessGpsIntegrity(input, opts = {}) {
99
+ const flags = [];
100
+ const now = opts.now ?? (() => Date.now());
101
+ const maxAgeMs = opts.maxAgeMs ?? 6e4;
102
+ const minAccuracy = opts.minAccuracyMeters ?? 1;
103
+ const { accuracy, altitude, altitudeAccuracy, heading, speed, timestamp } = input;
104
+ if (isNil(accuracy)) {
105
+ flags.push("accuracy_missing");
106
+ } else if (accuracy === 0) {
107
+ flags.push("accuracy_zero");
108
+ } else if (accuracy < minAccuracy) {
109
+ flags.push("accuracy_implausibly_small");
110
+ }
111
+ const hasMotion = !isNil(heading) || !isNil(speed);
112
+ if (hasMotion && (isNil(accuracy) || accuracy === 0)) {
113
+ flags.push("motion_without_accuracy");
114
+ }
115
+ if (!isNil(altitude) && isNil(altitudeAccuracy)) {
116
+ flags.push("altitude_without_accuracy");
117
+ }
118
+ if (timestamp !== void 0 && now() - timestamp > maxAgeMs) {
119
+ flags.push("stale_timestamp");
120
+ }
121
+ if (opts.permissionState === "denied" || opts.permissionState === "prompt") {
122
+ flags.push(`permission_${opts.permissionState}`);
123
+ }
124
+ return { suspicious: flags.length > 0, flags };
125
+ }
126
+ function gpsIntegrityInputFromPosition(position) {
127
+ const c = position.coords;
128
+ return {
129
+ latitude: c.latitude,
130
+ longitude: c.longitude,
131
+ accuracy: c.accuracy,
132
+ altitude: c.altitude,
133
+ altitudeAccuracy: c.altitudeAccuracy,
134
+ heading: c.heading,
135
+ speed: c.speed,
136
+ timestamp: position.timestamp
137
+ };
138
+ }
139
+ async function probeGeolocationPermission() {
140
+ try {
141
+ if (typeof navigator === "undefined" || !navigator.permissions?.query) {
142
+ return "unavailable";
143
+ }
144
+ const status = await navigator.permissions.query({ name: "geolocation" });
145
+ return status.state;
146
+ } catch {
147
+ return "unavailable";
148
+ }
149
+ }
150
+
96
151
  // src/geolocation/ciphertext.ts
97
152
  var CIPHER_TEXT_EXPIRY_MINUTES = 5;
98
153
  async function computeHMAC(key, message) {
@@ -145,6 +200,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
145
200
  if (typeof navigator === "undefined" || !navigator.geolocation) {
146
201
  return null;
147
202
  }
203
+ const permissionState = await probeGeolocationPermission();
148
204
  return new Promise((resolve) => {
149
205
  navigator.geolocation.getCurrentPosition(
150
206
  (position) => {
@@ -161,6 +217,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
161
217
  resolve(null);
162
218
  return;
163
219
  }
220
+ const { flags } = assessGpsIntegrity(gpsIntegrityInputFromPosition(position), { permissionState });
164
221
  resolve({
165
222
  latitude,
166
223
  longitude,
@@ -169,7 +226,8 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
169
226
  altitude_accuracy: position.coords.altitudeAccuracy ?? void 0,
170
227
  heading: position.coords.heading ?? void 0,
171
228
  speed: position.coords.speed ?? void 0,
172
- timestamp: position.timestamp
229
+ timestamp: position.timestamp,
230
+ integrity_flags: flags.length ? flags : void 0
173
231
  });
174
232
  },
175
233
  () => {
@@ -236,6 +294,9 @@ async function generateCipherText(options, config) {
236
294
  );
237
295
  if (location) {
238
296
  locationData = location;
297
+ if (location.integrity_flags?.length) {
298
+ warnings.push(`GPS integrity flags (advisory): ${location.integrity_flags.join(", ")}`);
299
+ }
239
300
  } else if (gpsRequiredByConfig) {
240
301
  throw new VesantError(
241
302
  `GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`,
@@ -338,8 +399,6 @@ function useGeolocation(client, options = {}) {
338
399
  if (optionsRef.current.autoVerify) {
339
400
  const detectAndVerify = async () => {
340
401
  try {
341
- const ipResponse = await fetch("https://api.ipify.org?format=json");
342
- const { ip } = await ipResponse.json();
343
402
  let deviceFingerprint;
344
403
  if (optionsRef.current.includeDeviceFingerprint && typeof window !== "undefined") {
345
404
  const deviceId = generateDeviceId();
@@ -353,7 +412,6 @@ function useGeolocation(client, options = {}) {
353
412
  };
354
413
  }
355
414
  await verifyIP({
356
- ip_address: ip,
357
415
  user_id: optionsRef.current.userId || "",
358
416
  event_type: optionsRef.current.eventType || "page_view",
359
417
  device_fingerprint: deviceFingerprint
@@ -667,6 +725,12 @@ function useLocationCapture(client, options) {
667
725
  if (accuracy !== null && accuracy !== void 0 && accuracy > 0) {
668
726
  capture.accuracy = accuracy;
669
727
  }
728
+ const { flags } = assessGpsIntegrity(gpsIntegrityInputFromPosition(position), {
729
+ permissionState: await probeGeolocationPermission()
730
+ });
731
+ if (flags.length) {
732
+ capture.integrity_flags = flags;
733
+ }
670
734
  }
671
735
  }
672
736
  if (gpsError) {