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