vesant-sdk 1.7.0 → 1.7.1-dev.027ea84
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.
- package/dist/{client-DtH2RLuy.d.ts → client-B3DCAHlg.d.ts} +2 -2
- package/dist/{client-DrjgZoH_.d.mts → client-BwXMQA2a.d.mts} +64 -42
- package/dist/{client-B0qhE2kr.d.mts → client-D23KhWeh.d.mts} +2 -2
- package/dist/{client-DF7hlMEz.d.ts → client-fy3trF2K.d.ts} +64 -42
- package/dist/{client-BolQlL5e.d.mts → client-q9fN8Hhf.d.mts} +103 -1
- package/dist/{client-BolQlL5e.d.ts → client-q9fN8Hhf.d.ts} +103 -1
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +181 -91
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +181 -91
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.d.mts +1 -1
- package/dist/decisions/index.d.ts +1 -1
- package/dist/decisions/index.js +69 -8
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +69 -8
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +68 -7
- package/dist/geolocation/index.d.ts +68 -7
- package/dist/geolocation/index.js +186 -91
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +183 -92
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index-C3zUKydT.d.mts +264 -0
- package/dist/index-DSDgS09k.d.ts +264 -0
- package/dist/index.d.mts +27 -10
- package/dist/index.d.ts +27 -10
- package/dist/index.js +358 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +349 -121
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +2 -2
- package/dist/kyc/core.d.ts +2 -2
- package/dist/kyc/core.js +79 -14
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +79 -15
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +126 -20
- package/dist/kyc/index.d.ts +126 -20
- package/dist/kyc/index.js +79 -14
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +79 -15
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +7 -3
- package/dist/react.d.ts +7 -3
- package/dist/react.js +73 -33
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +73 -33
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +1 -1
- package/dist/risk-profile/index.d.ts +1 -1
- package/dist/risk-profile/index.js +69 -8
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +69 -8
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.d.mts +1 -1
- package/dist/scores/index.d.ts +1 -1
- package/dist/scores/index.js +69 -8
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +69 -8
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +2 -2
- package/dist/tax/index.d.ts +2 -2
- package/dist/tax/index.js +74 -10
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +74 -10
- package/dist/tax/index.mjs.map +1 -1
- package/dist/webhooks/index.d.mts +2 -189
- package/dist/webhooks/index.d.ts +2 -189
- package/dist/webhooks/index.js +85 -21
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +85 -22
- package/dist/webhooks/index.mjs.map +1 -1
- 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,
|
|
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-
|
|
1
|
+
import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-BwXMQA2a.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-D23KhWeh.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-
|
|
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,
|
|
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-
|
|
1
|
+
import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-fy3trF2K.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-B3DCAHlg.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-
|
|
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
|
@@ -10,7 +10,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
10
10
|
// src/geolocation/hooks.ts
|
|
11
11
|
|
|
12
12
|
// src/core/version.ts
|
|
13
|
-
var SDK_VERSION = "1.7.
|
|
13
|
+
var SDK_VERSION = "1.7.1";
|
|
14
14
|
|
|
15
15
|
// src/core/errors.ts
|
|
16
16
|
var VesantError = class _VesantError extends Error {
|
|
@@ -93,27 +93,63 @@ function getBrowserInfo() {
|
|
|
93
93
|
return { browser, browser_version: browserVersion, os, os_version: osVersion };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// src/geolocation/
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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";
|
|
113
148
|
}
|
|
114
|
-
const { createHmac } = await import('crypto');
|
|
115
|
-
return createHmac("sha256", key).update(message).digest("hex");
|
|
116
149
|
}
|
|
150
|
+
|
|
151
|
+
// src/geolocation/ciphertext.ts
|
|
152
|
+
var CIPHER_TEXT_EXPIRY_MINUTES = 5;
|
|
117
153
|
function getWebGLInfo() {
|
|
118
154
|
if (typeof document === "undefined") return null;
|
|
119
155
|
try {
|
|
@@ -145,6 +181,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
145
181
|
if (typeof navigator === "undefined" || !navigator.geolocation) {
|
|
146
182
|
return null;
|
|
147
183
|
}
|
|
184
|
+
const permissionState = await probeGeolocationPermission();
|
|
148
185
|
return new Promise((resolve) => {
|
|
149
186
|
navigator.geolocation.getCurrentPosition(
|
|
150
187
|
(position) => {
|
|
@@ -161,6 +198,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
161
198
|
resolve(null);
|
|
162
199
|
return;
|
|
163
200
|
}
|
|
201
|
+
const { flags } = assessGpsIntegrity(gpsIntegrityInputFromPosition(position), { permissionState });
|
|
164
202
|
resolve({
|
|
165
203
|
latitude,
|
|
166
204
|
longitude,
|
|
@@ -169,7 +207,8 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
169
207
|
altitude_accuracy: position.coords.altitudeAccuracy ?? void 0,
|
|
170
208
|
heading: position.coords.heading ?? void 0,
|
|
171
209
|
speed: position.coords.speed ?? void 0,
|
|
172
|
-
timestamp: position.timestamp
|
|
210
|
+
timestamp: position.timestamp,
|
|
211
|
+
integrity_flags: flags.length ? flags : void 0
|
|
173
212
|
});
|
|
174
213
|
},
|
|
175
214
|
() => {
|
|
@@ -236,6 +275,9 @@ async function generateCipherText(options, config) {
|
|
|
236
275
|
);
|
|
237
276
|
if (location) {
|
|
238
277
|
locationData = location;
|
|
278
|
+
if (location.integrity_flags?.length) {
|
|
279
|
+
warnings.push(`GPS integrity flags (advisory): ${location.integrity_flags.join(", ")}`);
|
|
280
|
+
}
|
|
239
281
|
} else if (gpsRequiredByConfig) {
|
|
240
282
|
throw new VesantError(
|
|
241
283
|
`GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`,
|
|
@@ -265,15 +307,7 @@ async function generateCipherText(options, config) {
|
|
|
265
307
|
};
|
|
266
308
|
const encoded = encodePayload(payload);
|
|
267
309
|
const timestamp = now.getTime().toString(36);
|
|
268
|
-
|
|
269
|
-
const hmacKey = options.signingKey || options.apiKey;
|
|
270
|
-
if (hmacKey) {
|
|
271
|
-
const message = `02.${timestamp}.${encoded}`;
|
|
272
|
-
const hmac = await computeHMAC(hmacKey, message);
|
|
273
|
-
cipherText = `${message}.${hmac}`;
|
|
274
|
-
} else {
|
|
275
|
-
cipherText = `01.${timestamp}.${encoded}`;
|
|
276
|
-
}
|
|
310
|
+
const cipherText = `01.${timestamp}.${encoded}`;
|
|
277
311
|
return {
|
|
278
312
|
cipherText,
|
|
279
313
|
locationCaptured: !!locationData,
|
|
@@ -338,8 +372,6 @@ function useGeolocation(client, options = {}) {
|
|
|
338
372
|
if (optionsRef.current.autoVerify) {
|
|
339
373
|
const detectAndVerify = async () => {
|
|
340
374
|
try {
|
|
341
|
-
const ipResponse = await fetch("https://api.ipify.org?format=json");
|
|
342
|
-
const { ip } = await ipResponse.json();
|
|
343
375
|
let deviceFingerprint;
|
|
344
376
|
if (optionsRef.current.includeDeviceFingerprint && typeof window !== "undefined") {
|
|
345
377
|
const deviceId = generateDeviceId();
|
|
@@ -353,7 +385,6 @@ function useGeolocation(client, options = {}) {
|
|
|
353
385
|
};
|
|
354
386
|
}
|
|
355
387
|
await verifyIP({
|
|
356
|
-
ip_address: ip,
|
|
357
388
|
user_id: optionsRef.current.userId || "",
|
|
358
389
|
event_type: optionsRef.current.eventType || "page_view",
|
|
359
390
|
device_fingerprint: deviceFingerprint
|
|
@@ -667,6 +698,12 @@ function useLocationCapture(client, options) {
|
|
|
667
698
|
if (accuracy !== null && accuracy !== void 0 && accuracy > 0) {
|
|
668
699
|
capture.accuracy = accuracy;
|
|
669
700
|
}
|
|
701
|
+
const { flags } = assessGpsIntegrity(gpsIntegrityInputFromPosition(position), {
|
|
702
|
+
permissionState: await probeGeolocationPermission()
|
|
703
|
+
});
|
|
704
|
+
if (flags.length) {
|
|
705
|
+
capture.integrity_flags = flags;
|
|
706
|
+
}
|
|
670
707
|
}
|
|
671
708
|
}
|
|
672
709
|
if (gpsError) {
|
|
@@ -2095,6 +2132,7 @@ function isValidFileSize(file, maxSizeBytes = 10 * 1024 * 1024) {
|
|
|
2095
2132
|
}
|
|
2096
2133
|
function formatKycStatus(status) {
|
|
2097
2134
|
const statusMap = {
|
|
2135
|
+
awaiting_kyc: "Awaiting KYC",
|
|
2098
2136
|
pending: "Pending Review",
|
|
2099
2137
|
accepted: "Approved",
|
|
2100
2138
|
declined: "Rejected",
|
|
@@ -2105,6 +2143,8 @@ function formatKycStatus(status) {
|
|
|
2105
2143
|
}
|
|
2106
2144
|
function getStatusColor(status) {
|
|
2107
2145
|
const colorMap = {
|
|
2146
|
+
awaiting_kyc: "#94a3b8",
|
|
2147
|
+
// slate — not started
|
|
2108
2148
|
pending: "#f59e0b",
|
|
2109
2149
|
// amber
|
|
2110
2150
|
accepted: "#10b981",
|