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