vesant-sdk 1.6.1 → 1.6.2
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-DW1Xiz6a.d.mts → client-BlCxjbY2.d.mts} +6 -0
- package/dist/{client-eLbtPRkh.d.ts → client-C_A7QLcB.d.ts} +6 -0
- package/dist/compliance/index.d.mts +9 -2
- package/dist/compliance/index.d.ts +9 -2
- package/dist/compliance/index.js +177 -63
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +177 -63
- package/dist/compliance/index.mjs.map +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 +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +43 -14
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +43 -14
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +177 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -63
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.js +1 -1
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +1 -1
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.js +1 -1
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +1 -1
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- 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.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.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.d.mts +0 -1
- package/dist/tax/index.d.ts +0 -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/package.json +1 -1
|
@@ -222,7 +222,7 @@ function createConsoleLogger() {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
// src/core/version.ts
|
|
225
|
-
var SDK_VERSION = "1.6.
|
|
225
|
+
var SDK_VERSION = "1.6.2";
|
|
226
226
|
|
|
227
227
|
// src/shared/browser-utils.ts
|
|
228
228
|
function generateUUID() {
|
|
@@ -1036,22 +1036,51 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1036
1036
|
void 0,
|
|
1037
1037
|
requestOptions
|
|
1038
1038
|
);
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1039
|
+
const loc = cipherTextResult.location;
|
|
1040
|
+
const risk = cipherTextResult.risk;
|
|
1041
|
+
if (!risk) {
|
|
1042
|
+
const locationResult = await this.verifyIP({
|
|
1043
|
+
ip_address: ipAddress,
|
|
1044
|
+
user_id: userId,
|
|
1045
|
+
event_type: eventType
|
|
1046
|
+
}, requestOptions);
|
|
1047
|
+
return {
|
|
1048
|
+
ciphertext_valid: cipherTextResult.valid,
|
|
1049
|
+
ciphertext_result: cipherTextResult,
|
|
1050
|
+
location: locationResult
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
const location = {
|
|
1054
|
+
ip_address: cipherTextResult.ip_address,
|
|
1055
|
+
location: {
|
|
1056
|
+
country: loc?.country ?? "",
|
|
1057
|
+
country_iso: loc?.country_iso ?? "",
|
|
1058
|
+
city: loc?.city ?? "",
|
|
1059
|
+
region: loc?.region ?? "",
|
|
1060
|
+
postal_code: "",
|
|
1061
|
+
latitude: loc?.latitude ?? 0,
|
|
1062
|
+
longitude: loc?.longitude ?? 0,
|
|
1063
|
+
timezone: "",
|
|
1064
|
+
is_vpn: risk.is_vpn ?? false,
|
|
1065
|
+
is_proxy: risk.is_proxy ?? false,
|
|
1066
|
+
is_tor: risk.is_tor ?? false,
|
|
1067
|
+
is_hosting: risk.is_hosting ?? false,
|
|
1068
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
1069
|
+
},
|
|
1070
|
+
is_compliant: cipherTextResult.is_compliant ?? !risk.is_blocked,
|
|
1071
|
+
is_blocked: risk.is_blocked ?? false,
|
|
1072
|
+
risk_level: risk.level ?? "low",
|
|
1073
|
+
risk_score: risk.score ?? 0,
|
|
1074
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
1075
|
+
jurisdiction: cipherTextResult.jurisdiction,
|
|
1076
|
+
geofence_evaluation: cipherTextResult.geofence_evaluation,
|
|
1077
|
+
record_id: cipherTextResult.record_id ?? "",
|
|
1078
|
+
gps_required: cipherTextResult.gps_required
|
|
1079
|
+
};
|
|
1051
1080
|
return {
|
|
1052
1081
|
ciphertext_valid: cipherTextResult.valid,
|
|
1053
1082
|
ciphertext_result: cipherTextResult,
|
|
1054
|
-
location
|
|
1083
|
+
location
|
|
1055
1084
|
};
|
|
1056
1085
|
}
|
|
1057
1086
|
// ============================================================================
|
|
@@ -1456,28 +1485,34 @@ var ComplianceClient = class {
|
|
|
1456
1485
|
if (this.config.debug) {
|
|
1457
1486
|
this.logger.debug("Starting registration verification", { customerId: request.customerId });
|
|
1458
1487
|
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
email: request.emailAddress,
|
|
1462
|
-
phone: request.phoneNumber,
|
|
1463
|
-
date_of_birth: request.dateOfBirth
|
|
1464
|
-
} : void 0;
|
|
1465
|
-
[cipherTextResult, geoVerification] = await Promise.all([
|
|
1466
|
-
this.executeCipherTextValidation(
|
|
1488
|
+
if (request.cipherText) {
|
|
1489
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
1467
1490
|
request.cipherText,
|
|
1468
1491
|
request.customerId,
|
|
1469
1492
|
"registration",
|
|
1470
1493
|
request.ipAddress,
|
|
1471
|
-
|
|
1494
|
+
{
|
|
1495
|
+
full_name: request.fullName,
|
|
1496
|
+
email: request.emailAddress,
|
|
1497
|
+
phone: request.phoneNumber,
|
|
1498
|
+
date_of_birth: request.dateOfBirth
|
|
1499
|
+
},
|
|
1472
1500
|
requestOptions
|
|
1473
|
-
)
|
|
1474
|
-
this.geoClient.verifyIP({
|
|
1501
|
+
);
|
|
1502
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1475
1503
|
ip_address: request.ipAddress,
|
|
1476
1504
|
user_id: request.customerId,
|
|
1477
1505
|
event_type: "registration",
|
|
1478
1506
|
device_fingerprint: request.deviceFingerprint
|
|
1479
|
-
}, requestOptions)
|
|
1480
|
-
|
|
1507
|
+
}, requestOptions);
|
|
1508
|
+
} else {
|
|
1509
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
1510
|
+
ip_address: request.ipAddress,
|
|
1511
|
+
user_id: request.customerId,
|
|
1512
|
+
event_type: "registration",
|
|
1513
|
+
device_fingerprint: request.deviceFingerprint
|
|
1514
|
+
}, requestOptions);
|
|
1515
|
+
}
|
|
1481
1516
|
const blockReasons = this.evaluateRegistrationBlock(geoVerification, cipherTextResult);
|
|
1482
1517
|
if (blockReasons.length > 0) {
|
|
1483
1518
|
if (this.config.debug) {
|
|
@@ -1558,7 +1593,7 @@ var ComplianceClient = class {
|
|
|
1558
1593
|
evaluateRegistrationBlock(geoVerification, cipherTextResult) {
|
|
1559
1594
|
const blockReasons = [];
|
|
1560
1595
|
if (geoVerification.is_blocked) {
|
|
1561
|
-
blockReasons.push(...geoVerification.risk_reasons);
|
|
1596
|
+
blockReasons.push(...geoVerification.risk_reasons ?? []);
|
|
1562
1597
|
}
|
|
1563
1598
|
if (!geoVerification.is_compliant) {
|
|
1564
1599
|
if (!blockReasons.includes("non_compliant_jurisdiction")) {
|
|
@@ -1582,7 +1617,7 @@ var ComplianceClient = class {
|
|
|
1582
1617
|
}
|
|
1583
1618
|
}
|
|
1584
1619
|
if (geoVerification.geofence_evaluation?.blocked) {
|
|
1585
|
-
blockReasons.push(...geoVerification.geofence_evaluation.reasons);
|
|
1620
|
+
blockReasons.push(...geoVerification.geofence_evaluation.reasons ?? []);
|
|
1586
1621
|
}
|
|
1587
1622
|
if (geoVerification.risk_level === "critical") {
|
|
1588
1623
|
if (!blockReasons.includes("critical_risk_level")) {
|
|
@@ -1733,23 +1768,39 @@ var ComplianceClient = class {
|
|
|
1733
1768
|
if (this.config.debug) {
|
|
1734
1769
|
this.logger.debug("Starting login verification", { customerId: request.customerId });
|
|
1735
1770
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1771
|
+
let cipherTextResult;
|
|
1772
|
+
let geoVerification;
|
|
1773
|
+
let profileResult;
|
|
1774
|
+
if (request.cipherText) {
|
|
1775
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1776
|
+
this.executeCipherTextValidation(
|
|
1777
|
+
request.cipherText,
|
|
1778
|
+
request.customerId,
|
|
1779
|
+
"login",
|
|
1780
|
+
request.ipAddress,
|
|
1781
|
+
void 0,
|
|
1782
|
+
requestOptions
|
|
1783
|
+
),
|
|
1784
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1785
|
+
]);
|
|
1786
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1746
1787
|
ip_address: request.ipAddress,
|
|
1747
1788
|
user_id: request.customerId,
|
|
1748
1789
|
event_type: "login",
|
|
1749
1790
|
device_fingerprint: request.deviceFingerprint
|
|
1750
|
-
}, requestOptions)
|
|
1751
|
-
|
|
1752
|
-
|
|
1791
|
+
}, requestOptions);
|
|
1792
|
+
} else {
|
|
1793
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1794
|
+
Promise.resolve(void 0),
|
|
1795
|
+
this.geoClient.verifyIP({
|
|
1796
|
+
ip_address: request.ipAddress,
|
|
1797
|
+
user_id: request.customerId,
|
|
1798
|
+
event_type: "login",
|
|
1799
|
+
device_fingerprint: request.deviceFingerprint
|
|
1800
|
+
}, requestOptions),
|
|
1801
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1802
|
+
]);
|
|
1803
|
+
}
|
|
1753
1804
|
const loginBlockReasons = this.getBlockReasons(geoVerification, profileResult, cipherTextResult);
|
|
1754
1805
|
const isBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1755
1806
|
if (isBlocked && !profileResult) {
|
|
@@ -1834,23 +1885,39 @@ var ComplianceClient = class {
|
|
|
1834
1885
|
currency: request.currency
|
|
1835
1886
|
});
|
|
1836
1887
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1888
|
+
let cipherTextResult;
|
|
1889
|
+
let geoVerification;
|
|
1890
|
+
let profileResult;
|
|
1891
|
+
if (request.cipherText) {
|
|
1892
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1893
|
+
this.executeCipherTextValidation(
|
|
1894
|
+
request.cipherText,
|
|
1895
|
+
request.customerId,
|
|
1896
|
+
"transaction",
|
|
1897
|
+
request.ipAddress,
|
|
1898
|
+
void 0,
|
|
1899
|
+
requestOptions
|
|
1900
|
+
),
|
|
1901
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1902
|
+
]);
|
|
1903
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1847
1904
|
ip_address: request.ipAddress,
|
|
1848
1905
|
user_id: request.customerId,
|
|
1849
1906
|
event_type: "transaction",
|
|
1850
1907
|
device_fingerprint: request.deviceFingerprint
|
|
1851
|
-
}, requestOptions)
|
|
1852
|
-
|
|
1853
|
-
|
|
1908
|
+
}, requestOptions);
|
|
1909
|
+
} else {
|
|
1910
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1911
|
+
Promise.resolve(void 0),
|
|
1912
|
+
this.geoClient.verifyIP({
|
|
1913
|
+
ip_address: request.ipAddress,
|
|
1914
|
+
user_id: request.customerId,
|
|
1915
|
+
event_type: "transaction",
|
|
1916
|
+
device_fingerprint: request.deviceFingerprint
|
|
1917
|
+
}, requestOptions),
|
|
1918
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1919
|
+
]);
|
|
1920
|
+
}
|
|
1854
1921
|
const geoBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1855
1922
|
if (geoBlocked && !profileResult) {
|
|
1856
1923
|
return {
|
|
@@ -1914,22 +1981,31 @@ var ComplianceClient = class {
|
|
|
1914
1981
|
async verifyEvent(request, requestOptions) {
|
|
1915
1982
|
const startTime = Date.now();
|
|
1916
1983
|
this.validateEventRequest(request);
|
|
1917
|
-
|
|
1918
|
-
|
|
1984
|
+
let cipherTextResult;
|
|
1985
|
+
let geoVerification;
|
|
1986
|
+
if (request.cipherText) {
|
|
1987
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
1919
1988
|
request.cipherText,
|
|
1920
1989
|
request.customerId,
|
|
1921
1990
|
request.eventType,
|
|
1922
1991
|
request.ipAddress,
|
|
1923
1992
|
void 0,
|
|
1924
1993
|
requestOptions
|
|
1925
|
-
)
|
|
1926
|
-
this.geoClient.verifyIP({
|
|
1994
|
+
);
|
|
1995
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1996
|
+
ip_address: request.ipAddress,
|
|
1997
|
+
user_id: request.customerId,
|
|
1998
|
+
event_type: request.eventType,
|
|
1999
|
+
device_fingerprint: request.deviceFingerprint
|
|
2000
|
+
}, requestOptions);
|
|
2001
|
+
} else {
|
|
2002
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
1927
2003
|
ip_address: request.ipAddress,
|
|
1928
2004
|
user_id: request.customerId,
|
|
1929
2005
|
event_type: request.eventType,
|
|
1930
2006
|
device_fingerprint: request.deviceFingerprint
|
|
1931
|
-
}, requestOptions)
|
|
1932
|
-
|
|
2007
|
+
}, requestOptions);
|
|
2008
|
+
}
|
|
1933
2009
|
if (this.config.autoCreateProfiles) {
|
|
1934
2010
|
try {
|
|
1935
2011
|
const profile = await this.riskClient.getProfile(request.customerId, requestOptions);
|
|
@@ -1943,7 +2019,7 @@ var ComplianceClient = class {
|
|
|
1943
2019
|
}
|
|
1944
2020
|
}
|
|
1945
2021
|
const cipherTextBlocked = cipherTextResult ? !cipherTextResult.valid || cipherTextResult.risk?.is_blocked === true : false;
|
|
1946
|
-
const blockReasons = [...geoVerification.risk_reasons];
|
|
2022
|
+
const blockReasons = [...geoVerification.risk_reasons ?? []];
|
|
1947
2023
|
if (cipherTextResult) {
|
|
1948
2024
|
if (!cipherTextResult.valid) {
|
|
1949
2025
|
blockReasons.push("ciphertext_validation_failed");
|
|
@@ -2012,6 +2088,44 @@ var ComplianceClient = class {
|
|
|
2012
2088
|
return void 0;
|
|
2013
2089
|
}
|
|
2014
2090
|
}
|
|
2091
|
+
/**
|
|
2092
|
+
* Build a LocationVerification from a ValidateCipherTextResponse.
|
|
2093
|
+
* The validate-ciphertext endpoint now returns the full geo-verification data
|
|
2094
|
+
* (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
|
|
2095
|
+
* so a separate verifyIP call is unnecessary.
|
|
2096
|
+
*/
|
|
2097
|
+
buildLocationFromCipherText(ct, ipAddress) {
|
|
2098
|
+
const loc = ct.location;
|
|
2099
|
+
const risk = ct.risk;
|
|
2100
|
+
if (!risk) return null;
|
|
2101
|
+
return {
|
|
2102
|
+
ip_address: ct.ip_address || ipAddress,
|
|
2103
|
+
location: {
|
|
2104
|
+
country: loc?.country ?? "",
|
|
2105
|
+
country_iso: loc?.country_iso ?? "",
|
|
2106
|
+
city: loc?.city ?? "",
|
|
2107
|
+
region: loc?.region ?? "",
|
|
2108
|
+
postal_code: "",
|
|
2109
|
+
latitude: loc?.latitude ?? 0,
|
|
2110
|
+
longitude: loc?.longitude ?? 0,
|
|
2111
|
+
timezone: "",
|
|
2112
|
+
is_vpn: risk.is_vpn,
|
|
2113
|
+
is_proxy: risk.is_proxy,
|
|
2114
|
+
is_tor: risk.is_tor,
|
|
2115
|
+
is_hosting: risk.is_hosting ?? false,
|
|
2116
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
2117
|
+
},
|
|
2118
|
+
is_compliant: ct.is_compliant ?? !risk.is_blocked,
|
|
2119
|
+
is_blocked: risk.is_blocked,
|
|
2120
|
+
risk_level: risk.level,
|
|
2121
|
+
risk_score: risk.score,
|
|
2122
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
2123
|
+
jurisdiction: ct.jurisdiction,
|
|
2124
|
+
geofence_evaluation: ct.geofence_evaluation,
|
|
2125
|
+
record_id: ct.record_id ?? "",
|
|
2126
|
+
gps_required: ct.gps_required
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2015
2129
|
calculateTransactionRisk(amount, currency, geoVerification, profile, cipherTextResult) {
|
|
2016
2130
|
if (!this._currencyRatesCustomized && !this._currencyRatesWarned) {
|
|
2017
2131
|
this._currencyRatesWarned = true;
|
|
@@ -2082,7 +2196,7 @@ var ComplianceClient = class {
|
|
|
2082
2196
|
getBlockReasons(geoVerification, profile, cipherTextResult) {
|
|
2083
2197
|
const reasons = [];
|
|
2084
2198
|
if (geoVerification.is_blocked) {
|
|
2085
|
-
reasons.push(...geoVerification.risk_reasons);
|
|
2199
|
+
reasons.push(...geoVerification.risk_reasons ?? []);
|
|
2086
2200
|
}
|
|
2087
2201
|
if (profile) {
|
|
2088
2202
|
if (profile.customer_status === "suspended") {
|