vesant-sdk 1.6.6-next.ac58d2b → 2.0.0-dev.40d1c39
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/README.md +4 -4
- package/dist/client-BJ87_Vv5.d.ts +430 -0
- package/dist/{client-DPtiuQvW.d.ts → client-Bvp-f05-.d.ts} +6 -6
- package/dist/{client-D6PE3pcB.d.mts → client-CIEa7xYG.d.mts} +6 -6
- package/dist/client-IAOGCBfm.d.mts +430 -0
- package/dist/compliance/index.d.mts +25 -429
- package/dist/compliance/index.d.ts +25 -429
- package/dist/compliance/index.js +131 -34
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +131 -35
- 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 +1 -1
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +1 -1
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +3 -3
- package/dist/geolocation/index.d.ts +3 -3
- package/dist/geolocation/index.js +1 -1
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +1 -1
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +145 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -35
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +3 -3
- package/dist/kyc/core.d.ts +3 -3
- package/dist/kyc/core.js +15 -1
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +15 -2
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +7 -3
- package/dist/kyc/index.d.ts +7 -3
- package/dist/kyc/index.js +15 -1
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +15 -2
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +3 -3
- package/dist/risk-profile/index.d.ts +3 -3
- package/dist/risk-profile/index.js +1 -1
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +1 -1
- 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 +1 -1
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +1 -1
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.js +1 -1
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -1
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-_YQdS3Ax.d.ts → types-2utj53GK.d.ts} +2 -2
- package/dist/{types-DGDVnogO.d.mts → types-C4Zx0d_u.d.mts} +2 -2
- package/dist/{types-B4Ezqo7V.d.mts → types-QUCWam16.d.mts} +7 -1
- package/dist/{types-B4Ezqo7V.d.ts → types-QUCWam16.d.ts} +7 -1
- package/dist/webhooks/index.d.mts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/compliance/index.js
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// src/compliance/block-reasons.ts
|
|
4
|
+
var sdkReasons = {
|
|
5
|
+
// Jurisdiction
|
|
6
|
+
jurisdictionBlocked: (country, countryISO) => ({
|
|
7
|
+
code: "JURISDICTION_BLOCKED",
|
|
8
|
+
message: "Access from a blocked jurisdiction",
|
|
9
|
+
metadata: { country, country_iso: countryISO }
|
|
10
|
+
}),
|
|
11
|
+
jurisdictionNonCompliant: () => ({
|
|
12
|
+
code: "JURISDICTION_NON_COMPLIANT",
|
|
13
|
+
message: "Location does not meet compliance requirements"
|
|
14
|
+
}),
|
|
15
|
+
jurisdictionRegistrationDenied: () => ({
|
|
16
|
+
code: "JURISDICTION_REGISTRATION_DENIED",
|
|
17
|
+
message: "Registration is not permitted in this jurisdiction"
|
|
18
|
+
}),
|
|
19
|
+
jurisdictionRestricted: () => ({
|
|
20
|
+
code: "JURISDICTION_RESTRICTED",
|
|
21
|
+
message: "Access from a restricted jurisdiction"
|
|
22
|
+
}),
|
|
23
|
+
// Risk
|
|
24
|
+
riskCriticalLevel: () => ({
|
|
25
|
+
code: "RISK_CRITICAL_LEVEL",
|
|
26
|
+
message: "Risk assessment reached critical threshold"
|
|
27
|
+
}),
|
|
28
|
+
accountSuspended: () => ({
|
|
29
|
+
code: "RISK_ACCOUNT_SUSPENDED",
|
|
30
|
+
message: "Customer account is suspended"
|
|
31
|
+
}),
|
|
32
|
+
sanctionsMatch: () => ({
|
|
33
|
+
code: "RISK_SANCTIONS_MATCH",
|
|
34
|
+
message: "Customer profile matched against sanctions list"
|
|
35
|
+
}),
|
|
36
|
+
riskHighLocation: () => ({
|
|
37
|
+
code: "RISK_HIGH_LOCATION",
|
|
38
|
+
message: "High-risk geographic location"
|
|
39
|
+
}),
|
|
40
|
+
riskHighCustomer: () => ({
|
|
41
|
+
code: "RISK_HIGH_CUSTOMER",
|
|
42
|
+
message: "Customer flagged as high risk"
|
|
43
|
+
}),
|
|
44
|
+
// Device
|
|
45
|
+
ciphertextInvalid: () => ({
|
|
46
|
+
code: "DEVICE_CIPHERTEXT_INVALID",
|
|
47
|
+
message: "Device verification payload failed validation"
|
|
48
|
+
}),
|
|
49
|
+
gpsIPMismatch: () => ({
|
|
50
|
+
code: "DEVICE_GPS_IP_MISMATCH",
|
|
51
|
+
message: "GPS location does not match IP-derived location"
|
|
52
|
+
}),
|
|
53
|
+
gpsRequired: () => ({
|
|
54
|
+
code: "DEVICE_GPS_REQUIRED",
|
|
55
|
+
message: "GPS verification is required but was not provided"
|
|
56
|
+
}),
|
|
57
|
+
// Transaction
|
|
58
|
+
transactionHighAmount: (amount, currency, threshold) => ({
|
|
59
|
+
code: "TRANSACTION_HIGH_AMOUNT",
|
|
60
|
+
message: "Transaction amount exceeds high-value threshold",
|
|
61
|
+
metadata: { amount, currency, threshold }
|
|
62
|
+
}),
|
|
63
|
+
transactionElevatedAmount: (amount, currency, threshold) => ({
|
|
64
|
+
code: "TRANSACTION_ELEVATED_AMOUNT",
|
|
65
|
+
message: "Transaction amount exceeds elevated-value threshold",
|
|
66
|
+
metadata: { amount, currency, threshold }
|
|
67
|
+
}),
|
|
68
|
+
transactionJurisdictionLimit: () => ({
|
|
69
|
+
code: "TRANSACTION_JURISDICTION_LIMIT",
|
|
70
|
+
message: "Transaction amount exceeds jurisdiction limit"
|
|
71
|
+
}),
|
|
72
|
+
anonymizationDetected: () => ({
|
|
73
|
+
code: "NETWORK_ANONYMIZER_DETECTED",
|
|
74
|
+
message: "Anonymization tool detected"
|
|
75
|
+
})
|
|
76
|
+
};
|
|
77
|
+
|
|
3
78
|
// src/core/errors.ts
|
|
4
79
|
var VesantError = class _VesantError extends Error {
|
|
5
80
|
constructor(message, code, statusCode, details) {
|
|
@@ -224,7 +299,7 @@ function createConsoleLogger() {
|
|
|
224
299
|
}
|
|
225
300
|
|
|
226
301
|
// src/core/version.ts
|
|
227
|
-
var SDK_VERSION = "
|
|
302
|
+
var SDK_VERSION = "2.0.0";
|
|
228
303
|
|
|
229
304
|
// src/shared/browser-utils.ts
|
|
230
305
|
function generateUUID() {
|
|
@@ -1602,23 +1677,23 @@ var ComplianceClient = class {
|
|
|
1602
1677
|
blockReasons.push(...geoVerification.risk_reasons ?? []);
|
|
1603
1678
|
}
|
|
1604
1679
|
if (!geoVerification.is_compliant) {
|
|
1605
|
-
if (!blockReasons.
|
|
1606
|
-
blockReasons.push(
|
|
1680
|
+
if (!blockReasons.some((r) => r.code === "JURISDICTION_NON_COMPLIANT")) {
|
|
1681
|
+
blockReasons.push(sdkReasons.jurisdictionNonCompliant());
|
|
1607
1682
|
}
|
|
1608
1683
|
}
|
|
1609
1684
|
const jurisdiction = geoVerification.jurisdiction;
|
|
1610
1685
|
if (jurisdiction) {
|
|
1611
1686
|
if (jurisdiction.allow_registration === false) {
|
|
1612
|
-
blockReasons.push(
|
|
1687
|
+
blockReasons.push(sdkReasons.jurisdictionRegistrationDenied());
|
|
1613
1688
|
}
|
|
1614
1689
|
if (jurisdiction.status === "blocked" || jurisdiction.status === "sanctioned") {
|
|
1615
|
-
if (!blockReasons.
|
|
1616
|
-
blockReasons.push("
|
|
1690
|
+
if (!blockReasons.some((r) => r.code === "JURISDICTION_BLOCKED")) {
|
|
1691
|
+
blockReasons.push(sdkReasons.jurisdictionBlocked(jurisdiction.country_name ?? "", jurisdiction.country_iso ?? ""));
|
|
1617
1692
|
}
|
|
1618
1693
|
}
|
|
1619
1694
|
if (jurisdiction.status === "restricted" && jurisdiction.allow_registration === false) {
|
|
1620
|
-
if (!blockReasons.
|
|
1621
|
-
blockReasons.push(
|
|
1695
|
+
if (!blockReasons.some((r) => r.code === "JURISDICTION_RESTRICTED")) {
|
|
1696
|
+
blockReasons.push(sdkReasons.jurisdictionRestricted());
|
|
1622
1697
|
}
|
|
1623
1698
|
}
|
|
1624
1699
|
}
|
|
@@ -1626,25 +1701,30 @@ var ComplianceClient = class {
|
|
|
1626
1701
|
blockReasons.push(...geoVerification.geofence_evaluation.reasons ?? []);
|
|
1627
1702
|
}
|
|
1628
1703
|
if (geoVerification.risk_level === "critical") {
|
|
1629
|
-
if (!blockReasons.
|
|
1630
|
-
blockReasons.push(
|
|
1704
|
+
if (!blockReasons.some((r) => r.code === "RISK_CRITICAL_LEVEL")) {
|
|
1705
|
+
blockReasons.push(sdkReasons.riskCriticalLevel());
|
|
1631
1706
|
}
|
|
1632
1707
|
}
|
|
1633
1708
|
if (cipherTextResult) {
|
|
1634
1709
|
if (!cipherTextResult.valid) {
|
|
1635
|
-
blockReasons.push(
|
|
1710
|
+
blockReasons.push(sdkReasons.ciphertextInvalid());
|
|
1636
1711
|
}
|
|
1637
1712
|
if (cipherTextResult.risk?.is_blocked) {
|
|
1638
1713
|
blockReasons.push(...cipherTextResult.risk.block_reasons || []);
|
|
1639
1714
|
}
|
|
1640
1715
|
if (cipherTextResult.risk?.location_mismatch) {
|
|
1641
|
-
blockReasons.push(
|
|
1716
|
+
blockReasons.push(sdkReasons.gpsIPMismatch());
|
|
1642
1717
|
}
|
|
1643
1718
|
}
|
|
1644
1719
|
if (geoVerification.gps_required && !cipherTextResult) {
|
|
1645
|
-
blockReasons.push(
|
|
1720
|
+
blockReasons.push(sdkReasons.gpsRequired());
|
|
1646
1721
|
}
|
|
1647
|
-
|
|
1722
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1723
|
+
return blockReasons.filter((r) => {
|
|
1724
|
+
if (seen.has(r.code)) return false;
|
|
1725
|
+
seen.add(r.code);
|
|
1726
|
+
return true;
|
|
1727
|
+
});
|
|
1648
1728
|
}
|
|
1649
1729
|
/**
|
|
1650
1730
|
* Validate registration request has all required fields
|
|
@@ -2028,7 +2108,7 @@ var ComplianceClient = class {
|
|
|
2028
2108
|
const blockReasons = [...geoVerification.risk_reasons ?? []];
|
|
2029
2109
|
if (cipherTextResult) {
|
|
2030
2110
|
if (!cipherTextResult.valid) {
|
|
2031
|
-
blockReasons.push(
|
|
2111
|
+
blockReasons.push(sdkReasons.ciphertextInvalid());
|
|
2032
2112
|
}
|
|
2033
2113
|
if (cipherTextResult.risk?.is_blocked) {
|
|
2034
2114
|
blockReasons.push(...cipherTextResult.risk.block_reasons || []);
|
|
@@ -2036,12 +2116,18 @@ var ComplianceClient = class {
|
|
|
2036
2116
|
}
|
|
2037
2117
|
const gpsBlocked = geoVerification.gps_required && !cipherTextResult;
|
|
2038
2118
|
if (gpsBlocked) {
|
|
2039
|
-
blockReasons.push(
|
|
2119
|
+
blockReasons.push(sdkReasons.gpsRequired());
|
|
2040
2120
|
}
|
|
2121
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2122
|
+
const dedupedBlockReasons = blockReasons.filter((r) => {
|
|
2123
|
+
if (seen.has(r.code)) return false;
|
|
2124
|
+
seen.add(r.code);
|
|
2125
|
+
return true;
|
|
2126
|
+
});
|
|
2041
2127
|
return {
|
|
2042
2128
|
allowed: geoVerification.is_compliant && !geoVerification.is_blocked && !cipherTextBlocked && !gpsBlocked,
|
|
2043
2129
|
geolocation: geoVerification,
|
|
2044
|
-
blockReasons:
|
|
2130
|
+
blockReasons: dedupedBlockReasons,
|
|
2045
2131
|
processingTime: Date.now() - startTime,
|
|
2046
2132
|
cipherTextValidation: cipherTextResult
|
|
2047
2133
|
};
|
|
@@ -2144,31 +2230,31 @@ var ComplianceClient = class {
|
|
|
2144
2230
|
const normalizedAmount = this.normalizeToUSD(amount, currency);
|
|
2145
2231
|
if (normalizedAmount > 1e4) {
|
|
2146
2232
|
riskScore += 30;
|
|
2147
|
-
factors.push(
|
|
2233
|
+
factors.push(sdkReasons.transactionHighAmount(normalizedAmount, currency, 1e4));
|
|
2148
2234
|
} else if (normalizedAmount > 5e3) {
|
|
2149
2235
|
riskScore += 15;
|
|
2150
|
-
factors.push(
|
|
2236
|
+
factors.push(sdkReasons.transactionElevatedAmount(normalizedAmount, currency, 5e3));
|
|
2151
2237
|
}
|
|
2152
2238
|
riskScore += geoVerification.risk_score * 0.4;
|
|
2153
2239
|
if (geoVerification.risk_level === "high" || geoVerification.risk_level === "critical") {
|
|
2154
|
-
factors.push(
|
|
2240
|
+
factors.push(sdkReasons.riskHighLocation());
|
|
2155
2241
|
}
|
|
2156
2242
|
riskScore += profile.risk_score * 0.3;
|
|
2157
2243
|
if (profile.risk_category === "high" || profile.risk_category === "critical") {
|
|
2158
|
-
factors.push(
|
|
2244
|
+
factors.push(sdkReasons.riskHighCustomer());
|
|
2159
2245
|
}
|
|
2160
2246
|
if (geoVerification.location.is_vpn || geoVerification.location.is_proxy) {
|
|
2161
2247
|
riskScore += 20;
|
|
2162
|
-
factors.push(
|
|
2248
|
+
factors.push(sdkReasons.anonymizationDetected());
|
|
2163
2249
|
}
|
|
2164
2250
|
if (profile.customer_status === "suspended") {
|
|
2165
2251
|
riskScore += 50;
|
|
2166
|
-
factors.push(
|
|
2252
|
+
factors.push(sdkReasons.accountSuspended());
|
|
2167
2253
|
}
|
|
2168
2254
|
if (cipherTextResult) {
|
|
2169
2255
|
if (cipherTextResult.risk?.location_mismatch) {
|
|
2170
2256
|
riskScore += 20;
|
|
2171
|
-
factors.push(
|
|
2257
|
+
factors.push(sdkReasons.gpsIPMismatch());
|
|
2172
2258
|
}
|
|
2173
2259
|
if (cipherTextResult.risk?.score) {
|
|
2174
2260
|
riskScore += cipherTextResult.risk.score * 0.2;
|
|
@@ -2206,48 +2292,58 @@ var ComplianceClient = class {
|
|
|
2206
2292
|
}
|
|
2207
2293
|
if (profile) {
|
|
2208
2294
|
if (profile.customer_status === "suspended") {
|
|
2209
|
-
reasons.push(
|
|
2295
|
+
reasons.push(sdkReasons.accountSuspended());
|
|
2210
2296
|
}
|
|
2211
2297
|
if (profile.has_sanctions) {
|
|
2212
|
-
reasons.push(
|
|
2298
|
+
reasons.push(sdkReasons.sanctionsMatch());
|
|
2213
2299
|
}
|
|
2214
2300
|
}
|
|
2215
2301
|
if (cipherTextResult) {
|
|
2216
2302
|
if (!cipherTextResult.valid) {
|
|
2217
|
-
reasons.push(
|
|
2303
|
+
reasons.push(sdkReasons.ciphertextInvalid());
|
|
2218
2304
|
}
|
|
2219
2305
|
if (cipherTextResult.risk?.is_blocked) {
|
|
2220
2306
|
reasons.push(...cipherTextResult.risk.block_reasons || []);
|
|
2221
2307
|
}
|
|
2222
2308
|
}
|
|
2223
2309
|
if (geoVerification.gps_required && !cipherTextResult) {
|
|
2224
|
-
reasons.push(
|
|
2310
|
+
reasons.push(sdkReasons.gpsRequired());
|
|
2225
2311
|
}
|
|
2226
|
-
|
|
2312
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2313
|
+
return reasons.filter((r) => {
|
|
2314
|
+
if (seen.has(r.code)) return false;
|
|
2315
|
+
seen.add(r.code);
|
|
2316
|
+
return true;
|
|
2317
|
+
});
|
|
2227
2318
|
}
|
|
2228
2319
|
getTransactionBlockReasons(geoVerification, transactionRisk, jurisdictionAllowed, cipherTextResult) {
|
|
2229
2320
|
const reasons = [];
|
|
2230
2321
|
if (!geoVerification.is_compliant) {
|
|
2231
|
-
reasons.push(
|
|
2322
|
+
reasons.push(sdkReasons.jurisdictionNonCompliant());
|
|
2232
2323
|
}
|
|
2233
2324
|
if (!jurisdictionAllowed) {
|
|
2234
|
-
reasons.push(
|
|
2325
|
+
reasons.push(sdkReasons.transactionJurisdictionLimit());
|
|
2235
2326
|
}
|
|
2236
2327
|
if (!transactionRisk.allowed) {
|
|
2237
2328
|
reasons.push(...transactionRisk.factors);
|
|
2238
2329
|
}
|
|
2239
2330
|
if (cipherTextResult) {
|
|
2240
2331
|
if (!cipherTextResult.valid) {
|
|
2241
|
-
reasons.push(
|
|
2332
|
+
reasons.push(sdkReasons.ciphertextInvalid());
|
|
2242
2333
|
}
|
|
2243
2334
|
if (cipherTextResult.risk?.is_blocked) {
|
|
2244
2335
|
reasons.push(...cipherTextResult.risk.block_reasons || []);
|
|
2245
2336
|
}
|
|
2246
2337
|
}
|
|
2247
2338
|
if (geoVerification.gps_required && !cipherTextResult) {
|
|
2248
|
-
reasons.push(
|
|
2339
|
+
reasons.push(sdkReasons.gpsRequired());
|
|
2249
2340
|
}
|
|
2250
|
-
|
|
2341
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2342
|
+
return reasons.filter((r) => {
|
|
2343
|
+
if (seen.has(r.code)) return false;
|
|
2344
|
+
seen.add(r.code);
|
|
2345
|
+
return true;
|
|
2346
|
+
});
|
|
2251
2347
|
}
|
|
2252
2348
|
// ============================================================================
|
|
2253
2349
|
// Location Request Methods
|
|
@@ -2467,5 +2563,6 @@ var ComplianceClient = class {
|
|
|
2467
2563
|
|
|
2468
2564
|
exports.ComplianceClient = ComplianceClient;
|
|
2469
2565
|
exports.DEFAULT_CURRENCY_RATES = DEFAULT_CURRENCY_RATES;
|
|
2566
|
+
exports.sdkReasons = sdkReasons;
|
|
2470
2567
|
//# sourceMappingURL=index.js.map
|
|
2471
2568
|
//# sourceMappingURL=index.js.map
|