@zyphe-sdk/core 0.4.0 → 0.6.0
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/index.d.ts +6223 -1244
- package/dist/index.js +258 -11
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +4632 -719
- package/dist/openapi.json +14202 -6064
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,41 @@ var zypheApiClient = (opts) => {
|
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// src/utils/guards.ts
|
|
35
|
+
var ApiKeyTypes = {
|
|
36
|
+
PUBLISHABLE: "zyphe_pk_",
|
|
37
|
+
SECRET: "zyphe_sk_"
|
|
38
|
+
};
|
|
39
|
+
function ensureApiKeyType(apiKey, types) {
|
|
40
|
+
if (!types.some((type) => apiKey.startsWith(ApiKeyTypes[type]))) {
|
|
41
|
+
throw new Error(`Invalid API key. This function is only available for ${types.join(", ")} keys`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/aml.ts
|
|
46
|
+
async function screenAml({ organizationId, isSandbox, query, subjectType, locale }, opts) {
|
|
47
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
48
|
+
const client = zypheApiClient(opts);
|
|
49
|
+
return client.POST("/sdk/organizations/{organization_id}/aml/screen", {
|
|
50
|
+
params: {
|
|
51
|
+
path: {
|
|
52
|
+
organization_id: organizationId
|
|
53
|
+
},
|
|
54
|
+
query: {
|
|
55
|
+
sandbox: isSandbox,
|
|
56
|
+
locale
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
body: {
|
|
60
|
+
query,
|
|
61
|
+
subjectType
|
|
62
|
+
},
|
|
63
|
+
headers: {
|
|
64
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
34
69
|
// src/sdk-error.ts
|
|
35
70
|
var ZypheError = class _ZypheError extends Error {
|
|
36
71
|
errorTag;
|
|
@@ -187,17 +222,6 @@ async function completeDocumentSelectionStep({ verificationSession, payload }, o
|
|
|
187
222
|
return processDocumentSelectionResponse.data;
|
|
188
223
|
}
|
|
189
224
|
|
|
190
|
-
// src/utils/guards.ts
|
|
191
|
-
var ApiKeyTypes = {
|
|
192
|
-
PUBLISHABLE: "zyphe_pk_",
|
|
193
|
-
SECRET: "zyphe_sk_"
|
|
194
|
-
};
|
|
195
|
-
function ensureApiKeyType(apiKey, types) {
|
|
196
|
-
if (!types.some((type) => apiKey.startsWith(ApiKeyTypes[type]))) {
|
|
197
|
-
throw new Error(`Invalid API key. This function is only available for ${types.join(", ")} keys`);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
225
|
// src/gen/dv_result.ts
|
|
202
226
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
203
227
|
function imageProvenanceFromJSON(object) {
|
|
@@ -1375,6 +1399,218 @@ async function getDvResult({ organizationId, flowResultId, dvResultId, isSandbox
|
|
|
1375
1399
|
};
|
|
1376
1400
|
}
|
|
1377
1401
|
|
|
1402
|
+
// src/kyb.ts
|
|
1403
|
+
async function addKybUbos({ organizationId, kybResultId, isSandbox, persons, locale }, opts) {
|
|
1404
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1405
|
+
const client = zypheApiClient(opts);
|
|
1406
|
+
return client.POST("/sdk/organizations/{organization_id}/kyb/{kyb_result_id}/ubos", {
|
|
1407
|
+
params: {
|
|
1408
|
+
path: {
|
|
1409
|
+
organization_id: organizationId,
|
|
1410
|
+
kyb_result_id: kybResultId
|
|
1411
|
+
},
|
|
1412
|
+
query: {
|
|
1413
|
+
sandbox: isSandbox,
|
|
1414
|
+
locale
|
|
1415
|
+
}
|
|
1416
|
+
},
|
|
1417
|
+
body: {
|
|
1418
|
+
persons
|
|
1419
|
+
},
|
|
1420
|
+
headers: {
|
|
1421
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
async function removeKybUbo({ organizationId, kybResultId, personId, isSandbox, locale }, opts) {
|
|
1426
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1427
|
+
const client = zypheApiClient(opts);
|
|
1428
|
+
return client.DELETE("/sdk/organizations/{organization_id}/kyb/{kyb_result_id}/ubos/{person_id}", {
|
|
1429
|
+
params: {
|
|
1430
|
+
path: {
|
|
1431
|
+
organization_id: organizationId,
|
|
1432
|
+
kyb_result_id: kybResultId,
|
|
1433
|
+
person_id: personId
|
|
1434
|
+
},
|
|
1435
|
+
query: {
|
|
1436
|
+
sandbox: isSandbox,
|
|
1437
|
+
locale
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
headers: {
|
|
1441
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1442
|
+
}
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
async function addKybDirectors({ organizationId, kybResultId, isSandbox, persons, locale }, opts) {
|
|
1446
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1447
|
+
const client = zypheApiClient(opts);
|
|
1448
|
+
return client.POST("/sdk/organizations/{organization_id}/kyb/{kyb_result_id}/directors", {
|
|
1449
|
+
params: {
|
|
1450
|
+
path: {
|
|
1451
|
+
organization_id: organizationId,
|
|
1452
|
+
kyb_result_id: kybResultId
|
|
1453
|
+
},
|
|
1454
|
+
query: {
|
|
1455
|
+
sandbox: isSandbox,
|
|
1456
|
+
locale
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
body: {
|
|
1460
|
+
persons
|
|
1461
|
+
},
|
|
1462
|
+
headers: {
|
|
1463
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
async function removeKybDirector({ organizationId, kybResultId, personId, isSandbox, locale }, opts) {
|
|
1468
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1469
|
+
const client = zypheApiClient(opts);
|
|
1470
|
+
return client.DELETE("/sdk/organizations/{organization_id}/kyb/{kyb_result_id}/directors/{person_id}", {
|
|
1471
|
+
params: {
|
|
1472
|
+
path: {
|
|
1473
|
+
organization_id: organizationId,
|
|
1474
|
+
kyb_result_id: kybResultId,
|
|
1475
|
+
person_id: personId
|
|
1476
|
+
},
|
|
1477
|
+
query: {
|
|
1478
|
+
sandbox: isSandbox,
|
|
1479
|
+
locale
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
headers: {
|
|
1483
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
async function requestKybOnDemandDocument({ organizationId, kybResultId, documentKey, isSandbox, locale }, opts) {
|
|
1488
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1489
|
+
const client = zypheApiClient(opts);
|
|
1490
|
+
return client.POST("/sdk/organizations/{organization_id}/kyb/{kyb_result_id}/document-requests/on-demand", {
|
|
1491
|
+
params: {
|
|
1492
|
+
path: {
|
|
1493
|
+
organization_id: organizationId,
|
|
1494
|
+
kyb_result_id: kybResultId
|
|
1495
|
+
},
|
|
1496
|
+
query: {
|
|
1497
|
+
sandbox: isSandbox,
|
|
1498
|
+
locale
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
body: {
|
|
1502
|
+
documentKey
|
|
1503
|
+
},
|
|
1504
|
+
headers: {
|
|
1505
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
async function sendKybUboReminder({ organizationId, kybResultId, recipientIndex, isSandbox, locale }, opts) {
|
|
1510
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1511
|
+
const client = zypheApiClient(opts);
|
|
1512
|
+
return client.POST("/sdk/organizations/{organization_id}/kyb/{kyb_result_id}/reminders/ubo/{recipient_index}", {
|
|
1513
|
+
params: {
|
|
1514
|
+
path: {
|
|
1515
|
+
organization_id: organizationId,
|
|
1516
|
+
kyb_result_id: kybResultId,
|
|
1517
|
+
recipient_index: recipientIndex
|
|
1518
|
+
},
|
|
1519
|
+
query: {
|
|
1520
|
+
sandbox: isSandbox,
|
|
1521
|
+
locale
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
headers: {
|
|
1525
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
// src/tin-check.ts
|
|
1531
|
+
async function runTinCheck({ organizationId, isSandbox, name, tin, address, giin, mock, locale }, opts) {
|
|
1532
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1533
|
+
const client = zypheApiClient(opts);
|
|
1534
|
+
return client.POST("/sdk/organizations/{organization_id}/tin-checks", {
|
|
1535
|
+
params: {
|
|
1536
|
+
path: {
|
|
1537
|
+
organization_id: organizationId
|
|
1538
|
+
},
|
|
1539
|
+
query: {
|
|
1540
|
+
sandbox: isSandbox,
|
|
1541
|
+
locale
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
body: {
|
|
1545
|
+
name,
|
|
1546
|
+
tin,
|
|
1547
|
+
address,
|
|
1548
|
+
giin,
|
|
1549
|
+
mock
|
|
1550
|
+
},
|
|
1551
|
+
headers: {
|
|
1552
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
async function listTinChecks({ organizationId, isSandbox, take, skip, locale }, opts) {
|
|
1557
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1558
|
+
const client = zypheApiClient(opts);
|
|
1559
|
+
return client.GET("/sdk/organizations/{organization_id}/tin-checks", {
|
|
1560
|
+
params: {
|
|
1561
|
+
path: {
|
|
1562
|
+
organization_id: organizationId
|
|
1563
|
+
},
|
|
1564
|
+
query: {
|
|
1565
|
+
take,
|
|
1566
|
+
skip,
|
|
1567
|
+
sandbox: isSandbox,
|
|
1568
|
+
locale
|
|
1569
|
+
}
|
|
1570
|
+
},
|
|
1571
|
+
headers: {
|
|
1572
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
async function getTinCheck({ organizationId, checkId, isSandbox, locale }, opts) {
|
|
1577
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1578
|
+
const client = zypheApiClient(opts);
|
|
1579
|
+
return client.GET("/sdk/organizations/{organization_id}/tin-checks/{check_id}", {
|
|
1580
|
+
params: {
|
|
1581
|
+
path: {
|
|
1582
|
+
organization_id: organizationId,
|
|
1583
|
+
check_id: checkId
|
|
1584
|
+
},
|
|
1585
|
+
query: {
|
|
1586
|
+
sandbox: isSandbox,
|
|
1587
|
+
locale
|
|
1588
|
+
}
|
|
1589
|
+
},
|
|
1590
|
+
headers: {
|
|
1591
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
async function getTinCheckQuote({ organizationId, isSandbox, locale }, opts) {
|
|
1596
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1597
|
+
const client = zypheApiClient(opts);
|
|
1598
|
+
return client.GET("/sdk/organizations/{organization_id}/tin-checks/quote", {
|
|
1599
|
+
params: {
|
|
1600
|
+
path: {
|
|
1601
|
+
organization_id: organizationId
|
|
1602
|
+
},
|
|
1603
|
+
query: {
|
|
1604
|
+
sandbox: isSandbox,
|
|
1605
|
+
locale
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
headers: {
|
|
1609
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1378
1614
|
// src/types.ts
|
|
1379
1615
|
var DocumentType = {
|
|
1380
1616
|
IDENTITY_CARD: 12,
|
|
@@ -1546,6 +1782,8 @@ export {
|
|
|
1546
1782
|
WebhookSignatureErrorCodes,
|
|
1547
1783
|
WebhookSignatureErrorMessages,
|
|
1548
1784
|
ZypheError,
|
|
1785
|
+
addKybDirectors,
|
|
1786
|
+
addKybUbos,
|
|
1549
1787
|
bufferToHex,
|
|
1550
1788
|
completeDocumentSelectionStep,
|
|
1551
1789
|
completeDvStep,
|
|
@@ -1555,9 +1793,18 @@ export {
|
|
|
1555
1793
|
getDvResult,
|
|
1556
1794
|
getFlowResult,
|
|
1557
1795
|
getNextStepDetails,
|
|
1796
|
+
getTinCheck,
|
|
1797
|
+
getTinCheckQuote,
|
|
1558
1798
|
hexToBytes,
|
|
1559
1799
|
listFlowResults,
|
|
1800
|
+
listTinChecks,
|
|
1560
1801
|
parseSignatureHeader,
|
|
1802
|
+
removeKybDirector,
|
|
1803
|
+
removeKybUbo,
|
|
1804
|
+
requestKybOnDemandDocument,
|
|
1805
|
+
runTinCheck,
|
|
1806
|
+
screenAml,
|
|
1807
|
+
sendKybUboReminder,
|
|
1561
1808
|
timingSafeEqual
|
|
1562
1809
|
};
|
|
1563
1810
|
//# sourceMappingURL=index.js.map
|