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
package/dist/index.js
CHANGED
|
@@ -242,7 +242,7 @@ var noopLogger = {
|
|
|
242
242
|
};
|
|
243
243
|
|
|
244
244
|
// src/core/version.ts
|
|
245
|
-
var SDK_VERSION = "1.6.
|
|
245
|
+
var SDK_VERSION = "1.6.2";
|
|
246
246
|
|
|
247
247
|
// src/shared/browser-utils.ts
|
|
248
248
|
function generateUUID() {
|
|
@@ -1123,22 +1123,51 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1123
1123
|
void 0,
|
|
1124
1124
|
requestOptions
|
|
1125
1125
|
);
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1126
|
+
const loc = cipherTextResult.location;
|
|
1127
|
+
const risk = cipherTextResult.risk;
|
|
1128
|
+
if (!risk) {
|
|
1129
|
+
const locationResult = await this.verifyIP({
|
|
1130
|
+
ip_address: ipAddress,
|
|
1131
|
+
user_id: userId,
|
|
1132
|
+
event_type: eventType
|
|
1133
|
+
}, requestOptions);
|
|
1134
|
+
return {
|
|
1135
|
+
ciphertext_valid: cipherTextResult.valid,
|
|
1136
|
+
ciphertext_result: cipherTextResult,
|
|
1137
|
+
location: locationResult
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
const location = {
|
|
1141
|
+
ip_address: cipherTextResult.ip_address,
|
|
1142
|
+
location: {
|
|
1143
|
+
country: loc?.country ?? "",
|
|
1144
|
+
country_iso: loc?.country_iso ?? "",
|
|
1145
|
+
city: loc?.city ?? "",
|
|
1146
|
+
region: loc?.region ?? "",
|
|
1147
|
+
postal_code: "",
|
|
1148
|
+
latitude: loc?.latitude ?? 0,
|
|
1149
|
+
longitude: loc?.longitude ?? 0,
|
|
1150
|
+
timezone: "",
|
|
1151
|
+
is_vpn: risk.is_vpn ?? false,
|
|
1152
|
+
is_proxy: risk.is_proxy ?? false,
|
|
1153
|
+
is_tor: risk.is_tor ?? false,
|
|
1154
|
+
is_hosting: risk.is_hosting ?? false,
|
|
1155
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
1156
|
+
},
|
|
1157
|
+
is_compliant: cipherTextResult.is_compliant ?? !risk.is_blocked,
|
|
1158
|
+
is_blocked: risk.is_blocked ?? false,
|
|
1159
|
+
risk_level: risk.level ?? "low",
|
|
1160
|
+
risk_score: risk.score ?? 0,
|
|
1161
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
1162
|
+
jurisdiction: cipherTextResult.jurisdiction,
|
|
1163
|
+
geofence_evaluation: cipherTextResult.geofence_evaluation,
|
|
1164
|
+
record_id: cipherTextResult.record_id ?? "",
|
|
1165
|
+
gps_required: cipherTextResult.gps_required
|
|
1166
|
+
};
|
|
1138
1167
|
return {
|
|
1139
1168
|
ciphertext_valid: cipherTextResult.valid,
|
|
1140
1169
|
ciphertext_result: cipherTextResult,
|
|
1141
|
-
location
|
|
1170
|
+
location
|
|
1142
1171
|
};
|
|
1143
1172
|
}
|
|
1144
1173
|
// ============================================================================
|
|
@@ -1543,28 +1572,34 @@ var ComplianceClient = class {
|
|
|
1543
1572
|
if (this.config.debug) {
|
|
1544
1573
|
this.logger.debug("Starting registration verification", { customerId: request.customerId });
|
|
1545
1574
|
}
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
email: request.emailAddress,
|
|
1549
|
-
phone: request.phoneNumber,
|
|
1550
|
-
date_of_birth: request.dateOfBirth
|
|
1551
|
-
} : void 0;
|
|
1552
|
-
[cipherTextResult, geoVerification] = await Promise.all([
|
|
1553
|
-
this.executeCipherTextValidation(
|
|
1575
|
+
if (request.cipherText) {
|
|
1576
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
1554
1577
|
request.cipherText,
|
|
1555
1578
|
request.customerId,
|
|
1556
1579
|
"registration",
|
|
1557
1580
|
request.ipAddress,
|
|
1558
|
-
|
|
1581
|
+
{
|
|
1582
|
+
full_name: request.fullName,
|
|
1583
|
+
email: request.emailAddress,
|
|
1584
|
+
phone: request.phoneNumber,
|
|
1585
|
+
date_of_birth: request.dateOfBirth
|
|
1586
|
+
},
|
|
1559
1587
|
requestOptions
|
|
1560
|
-
)
|
|
1561
|
-
this.geoClient.verifyIP({
|
|
1588
|
+
);
|
|
1589
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1562
1590
|
ip_address: request.ipAddress,
|
|
1563
1591
|
user_id: request.customerId,
|
|
1564
1592
|
event_type: "registration",
|
|
1565
1593
|
device_fingerprint: request.deviceFingerprint
|
|
1566
|
-
}, requestOptions)
|
|
1567
|
-
|
|
1594
|
+
}, requestOptions);
|
|
1595
|
+
} else {
|
|
1596
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
1597
|
+
ip_address: request.ipAddress,
|
|
1598
|
+
user_id: request.customerId,
|
|
1599
|
+
event_type: "registration",
|
|
1600
|
+
device_fingerprint: request.deviceFingerprint
|
|
1601
|
+
}, requestOptions);
|
|
1602
|
+
}
|
|
1568
1603
|
const blockReasons = this.evaluateRegistrationBlock(geoVerification, cipherTextResult);
|
|
1569
1604
|
if (blockReasons.length > 0) {
|
|
1570
1605
|
if (this.config.debug) {
|
|
@@ -1645,7 +1680,7 @@ var ComplianceClient = class {
|
|
|
1645
1680
|
evaluateRegistrationBlock(geoVerification, cipherTextResult) {
|
|
1646
1681
|
const blockReasons = [];
|
|
1647
1682
|
if (geoVerification.is_blocked) {
|
|
1648
|
-
blockReasons.push(...geoVerification.risk_reasons);
|
|
1683
|
+
blockReasons.push(...geoVerification.risk_reasons ?? []);
|
|
1649
1684
|
}
|
|
1650
1685
|
if (!geoVerification.is_compliant) {
|
|
1651
1686
|
if (!blockReasons.includes("non_compliant_jurisdiction")) {
|
|
@@ -1669,7 +1704,7 @@ var ComplianceClient = class {
|
|
|
1669
1704
|
}
|
|
1670
1705
|
}
|
|
1671
1706
|
if (geoVerification.geofence_evaluation?.blocked) {
|
|
1672
|
-
blockReasons.push(...geoVerification.geofence_evaluation.reasons);
|
|
1707
|
+
blockReasons.push(...geoVerification.geofence_evaluation.reasons ?? []);
|
|
1673
1708
|
}
|
|
1674
1709
|
if (geoVerification.risk_level === "critical") {
|
|
1675
1710
|
if (!blockReasons.includes("critical_risk_level")) {
|
|
@@ -1820,23 +1855,39 @@ var ComplianceClient = class {
|
|
|
1820
1855
|
if (this.config.debug) {
|
|
1821
1856
|
this.logger.debug("Starting login verification", { customerId: request.customerId });
|
|
1822
1857
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1858
|
+
let cipherTextResult;
|
|
1859
|
+
let geoVerification;
|
|
1860
|
+
let profileResult;
|
|
1861
|
+
if (request.cipherText) {
|
|
1862
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1863
|
+
this.executeCipherTextValidation(
|
|
1864
|
+
request.cipherText,
|
|
1865
|
+
request.customerId,
|
|
1866
|
+
"login",
|
|
1867
|
+
request.ipAddress,
|
|
1868
|
+
void 0,
|
|
1869
|
+
requestOptions
|
|
1870
|
+
),
|
|
1871
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1872
|
+
]);
|
|
1873
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1833
1874
|
ip_address: request.ipAddress,
|
|
1834
1875
|
user_id: request.customerId,
|
|
1835
1876
|
event_type: "login",
|
|
1836
1877
|
device_fingerprint: request.deviceFingerprint
|
|
1837
|
-
}, requestOptions)
|
|
1838
|
-
|
|
1839
|
-
|
|
1878
|
+
}, requestOptions);
|
|
1879
|
+
} else {
|
|
1880
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1881
|
+
Promise.resolve(void 0),
|
|
1882
|
+
this.geoClient.verifyIP({
|
|
1883
|
+
ip_address: request.ipAddress,
|
|
1884
|
+
user_id: request.customerId,
|
|
1885
|
+
event_type: "login",
|
|
1886
|
+
device_fingerprint: request.deviceFingerprint
|
|
1887
|
+
}, requestOptions),
|
|
1888
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1889
|
+
]);
|
|
1890
|
+
}
|
|
1840
1891
|
const loginBlockReasons = this.getBlockReasons(geoVerification, profileResult, cipherTextResult);
|
|
1841
1892
|
const isBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1842
1893
|
if (isBlocked && !profileResult) {
|
|
@@ -1921,23 +1972,39 @@ var ComplianceClient = class {
|
|
|
1921
1972
|
currency: request.currency
|
|
1922
1973
|
});
|
|
1923
1974
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1975
|
+
let cipherTextResult;
|
|
1976
|
+
let geoVerification;
|
|
1977
|
+
let profileResult;
|
|
1978
|
+
if (request.cipherText) {
|
|
1979
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1980
|
+
this.executeCipherTextValidation(
|
|
1981
|
+
request.cipherText,
|
|
1982
|
+
request.customerId,
|
|
1983
|
+
"transaction",
|
|
1984
|
+
request.ipAddress,
|
|
1985
|
+
void 0,
|
|
1986
|
+
requestOptions
|
|
1987
|
+
),
|
|
1988
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1989
|
+
]);
|
|
1990
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1934
1991
|
ip_address: request.ipAddress,
|
|
1935
1992
|
user_id: request.customerId,
|
|
1936
1993
|
event_type: "transaction",
|
|
1937
1994
|
device_fingerprint: request.deviceFingerprint
|
|
1938
|
-
}, requestOptions)
|
|
1939
|
-
|
|
1940
|
-
|
|
1995
|
+
}, requestOptions);
|
|
1996
|
+
} else {
|
|
1997
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1998
|
+
Promise.resolve(void 0),
|
|
1999
|
+
this.geoClient.verifyIP({
|
|
2000
|
+
ip_address: request.ipAddress,
|
|
2001
|
+
user_id: request.customerId,
|
|
2002
|
+
event_type: "transaction",
|
|
2003
|
+
device_fingerprint: request.deviceFingerprint
|
|
2004
|
+
}, requestOptions),
|
|
2005
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
2006
|
+
]);
|
|
2007
|
+
}
|
|
1941
2008
|
const geoBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1942
2009
|
if (geoBlocked && !profileResult) {
|
|
1943
2010
|
return {
|
|
@@ -2001,22 +2068,31 @@ var ComplianceClient = class {
|
|
|
2001
2068
|
async verifyEvent(request, requestOptions) {
|
|
2002
2069
|
const startTime = Date.now();
|
|
2003
2070
|
this.validateEventRequest(request);
|
|
2004
|
-
|
|
2005
|
-
|
|
2071
|
+
let cipherTextResult;
|
|
2072
|
+
let geoVerification;
|
|
2073
|
+
if (request.cipherText) {
|
|
2074
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
2006
2075
|
request.cipherText,
|
|
2007
2076
|
request.customerId,
|
|
2008
2077
|
request.eventType,
|
|
2009
2078
|
request.ipAddress,
|
|
2010
2079
|
void 0,
|
|
2011
2080
|
requestOptions
|
|
2012
|
-
)
|
|
2013
|
-
this.geoClient.verifyIP({
|
|
2081
|
+
);
|
|
2082
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
2014
2083
|
ip_address: request.ipAddress,
|
|
2015
2084
|
user_id: request.customerId,
|
|
2016
2085
|
event_type: request.eventType,
|
|
2017
2086
|
device_fingerprint: request.deviceFingerprint
|
|
2018
|
-
}, requestOptions)
|
|
2019
|
-
|
|
2087
|
+
}, requestOptions);
|
|
2088
|
+
} else {
|
|
2089
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
2090
|
+
ip_address: request.ipAddress,
|
|
2091
|
+
user_id: request.customerId,
|
|
2092
|
+
event_type: request.eventType,
|
|
2093
|
+
device_fingerprint: request.deviceFingerprint
|
|
2094
|
+
}, requestOptions);
|
|
2095
|
+
}
|
|
2020
2096
|
if (this.config.autoCreateProfiles) {
|
|
2021
2097
|
try {
|
|
2022
2098
|
const profile = await this.riskClient.getProfile(request.customerId, requestOptions);
|
|
@@ -2030,7 +2106,7 @@ var ComplianceClient = class {
|
|
|
2030
2106
|
}
|
|
2031
2107
|
}
|
|
2032
2108
|
const cipherTextBlocked = cipherTextResult ? !cipherTextResult.valid || cipherTextResult.risk?.is_blocked === true : false;
|
|
2033
|
-
const blockReasons = [...geoVerification.risk_reasons];
|
|
2109
|
+
const blockReasons = [...geoVerification.risk_reasons ?? []];
|
|
2034
2110
|
if (cipherTextResult) {
|
|
2035
2111
|
if (!cipherTextResult.valid) {
|
|
2036
2112
|
blockReasons.push("ciphertext_validation_failed");
|
|
@@ -2099,6 +2175,44 @@ var ComplianceClient = class {
|
|
|
2099
2175
|
return void 0;
|
|
2100
2176
|
}
|
|
2101
2177
|
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Build a LocationVerification from a ValidateCipherTextResponse.
|
|
2180
|
+
* The validate-ciphertext endpoint now returns the full geo-verification data
|
|
2181
|
+
* (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
|
|
2182
|
+
* so a separate verifyIP call is unnecessary.
|
|
2183
|
+
*/
|
|
2184
|
+
buildLocationFromCipherText(ct, ipAddress) {
|
|
2185
|
+
const loc = ct.location;
|
|
2186
|
+
const risk = ct.risk;
|
|
2187
|
+
if (!risk) return null;
|
|
2188
|
+
return {
|
|
2189
|
+
ip_address: ct.ip_address || ipAddress,
|
|
2190
|
+
location: {
|
|
2191
|
+
country: loc?.country ?? "",
|
|
2192
|
+
country_iso: loc?.country_iso ?? "",
|
|
2193
|
+
city: loc?.city ?? "",
|
|
2194
|
+
region: loc?.region ?? "",
|
|
2195
|
+
postal_code: "",
|
|
2196
|
+
latitude: loc?.latitude ?? 0,
|
|
2197
|
+
longitude: loc?.longitude ?? 0,
|
|
2198
|
+
timezone: "",
|
|
2199
|
+
is_vpn: risk.is_vpn,
|
|
2200
|
+
is_proxy: risk.is_proxy,
|
|
2201
|
+
is_tor: risk.is_tor,
|
|
2202
|
+
is_hosting: risk.is_hosting ?? false,
|
|
2203
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
2204
|
+
},
|
|
2205
|
+
is_compliant: ct.is_compliant ?? !risk.is_blocked,
|
|
2206
|
+
is_blocked: risk.is_blocked,
|
|
2207
|
+
risk_level: risk.level,
|
|
2208
|
+
risk_score: risk.score,
|
|
2209
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
2210
|
+
jurisdiction: ct.jurisdiction,
|
|
2211
|
+
geofence_evaluation: ct.geofence_evaluation,
|
|
2212
|
+
record_id: ct.record_id ?? "",
|
|
2213
|
+
gps_required: ct.gps_required
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2102
2216
|
calculateTransactionRisk(amount, currency, geoVerification, profile, cipherTextResult) {
|
|
2103
2217
|
if (!this._currencyRatesCustomized && !this._currencyRatesWarned) {
|
|
2104
2218
|
this._currencyRatesWarned = true;
|
|
@@ -2169,7 +2283,7 @@ var ComplianceClient = class {
|
|
|
2169
2283
|
getBlockReasons(geoVerification, profile, cipherTextResult) {
|
|
2170
2284
|
const reasons = [];
|
|
2171
2285
|
if (geoVerification.is_blocked) {
|
|
2172
|
-
reasons.push(...geoVerification.risk_reasons);
|
|
2286
|
+
reasons.push(...geoVerification.risk_reasons ?? []);
|
|
2173
2287
|
}
|
|
2174
2288
|
if (profile) {
|
|
2175
2289
|
if (profile.customer_status === "suspended") {
|