@didit-protocol/sdk-node 2.10.0 → 2.11.1
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 +1 -0
- package/dist/index.cjs +97 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +293 -4
- package/dist/index.d.ts +293 -4
- package/dist/index.js +97 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -146,7 +146,7 @@ function errorDetail(body) {
|
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
148
|
function spellings(secret) {
|
|
149
|
-
const out = /* @__PURE__ */ new Set([secret]);
|
|
149
|
+
const out = /* @__PURE__ */ new Set([secret, JSON.stringify(secret).slice(1, -1)]);
|
|
150
150
|
try {
|
|
151
151
|
out.add(encodeURIComponent(secret));
|
|
152
152
|
out.add(new URLSearchParams({ s: secret }).toString().slice(2));
|
|
@@ -278,7 +278,7 @@ function decodeDates(value, plan, named, depth = 0) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
// src/core/version.ts
|
|
281
|
-
var VERSION = "2.
|
|
281
|
+
var VERSION = "2.11.1";
|
|
282
282
|
|
|
283
283
|
// src/core/runtime.ts
|
|
284
284
|
function processLike() {
|
|
@@ -1948,6 +1948,8 @@ var AccountApplications = class extends APIResource {
|
|
|
1948
1948
|
*
|
|
1949
1949
|
* Create an application inside an organization, in the data location you choose (`data_location`, the European Union by default; it can't be changed afterwards). The response includes `api_key`; persist it now (recoverable via GET). Requires owner/admin JWT.
|
|
1950
1950
|
*
|
|
1951
|
+
* Set initiate_login_uri to your HTTPS sign-in page on the exact website_url hostname, or an empty string to disable admin-sent sign-in links. Changing website_url also revalidates the saved sign-in URI. Invalid values return 400 with an initiate_login_uri field error; hostname and URI policy failures use https_url_on_registered_website_required.
|
|
1952
|
+
*
|
|
1951
1953
|
* `POST /organizations/me/{org_id}/applications/`
|
|
1952
1954
|
*
|
|
1953
1955
|
* @param orgId UUID of the organization. Look it up with `GET /organizations/me/`.
|
|
@@ -1985,6 +1987,8 @@ var AccountApplications = class extends APIResource {
|
|
|
1985
1987
|
*
|
|
1986
1988
|
* Update application metadata (name, URLs, redirect URIs). `api_key` and `client_id` are never rotated. `products` is read-only: a `products` key in the body is ignored. `data_location` can't be changed after the application is created, except once on the live application created with your organization, while it is unused (see the request body). Requires owner/admin JWT.
|
|
1987
1989
|
*
|
|
1990
|
+
* Set initiate_login_uri to your HTTPS sign-in page on the exact website_url hostname, or an empty string to disable admin-sent sign-in links. Changing website_url also revalidates the saved sign-in URI. Invalid values return 400 with an initiate_login_uri field error; hostname and URI policy failures use https_url_on_registered_website_required.
|
|
1991
|
+
*
|
|
1988
1992
|
* `PATCH /organizations/me/{org_id}/applications/{app_id}/`
|
|
1989
1993
|
*
|
|
1990
1994
|
* @param orgId UUID of the organization that owns the application.
|
|
@@ -6520,6 +6524,21 @@ var ReportTemplates = class extends APIResource {
|
|
|
6520
6524
|
}
|
|
6521
6525
|
};
|
|
6522
6526
|
|
|
6527
|
+
// src/resources/sandbox.ts
|
|
6528
|
+
var SANDBOX_LIST_SCENARIOS = { method: "GET", path: "/v1/sandbox/scenarios/" };
|
|
6529
|
+
var Sandbox = class extends APIResource {
|
|
6530
|
+
/**
|
|
6531
|
+
* List sandbox scenarios and Test VASP metadata
|
|
6532
|
+
*
|
|
6533
|
+
* Read the sandbox catalog Didit serves for testing. Authenticate with your application's API key or access token; a sandbox session's `Session-Token` also reads it, narrowed to the scenarios that session's workflow can produce. `scenarios`, `magic_values`, `risk_cases`, `sample_identity` and `delivery_conventions` describe the mocked session outcomes and the values that trigger them. `travel_rule` is the Didit Test VASP: its identity, the `routes` it answers over, and each scenario's own `route`. Every Test VASP exchange runs in process inside Didit, so `TEST_VASP` is not a live network or email transport and no real VASP is contacted. Pick a Travel Rule scenario by its beneficiary wallet address or by a beneficiary name of the form `Didit Test VASP <suffix>`. See [Travel Rule sandbox testing](/transaction-monitoring/travel-rule-sandbox).
|
|
6534
|
+
*
|
|
6535
|
+
* `GET /v1/sandbox/scenarios/`
|
|
6536
|
+
*/
|
|
6537
|
+
listScenarios(options) {
|
|
6538
|
+
return this._client.request(SANDBOX_LIST_SCENARIOS, [], void 0, options);
|
|
6539
|
+
}
|
|
6540
|
+
};
|
|
6541
|
+
|
|
6523
6542
|
// src/resources/sessions.ts
|
|
6524
6543
|
var SESSIONS_IMPORTS_CANCEL = {
|
|
6525
6544
|
method: "POST",
|
|
@@ -10634,6 +10653,7 @@ var DiditResources = class extends APIClient {
|
|
|
10634
10653
|
questionnaires = new Questionnaires(this);
|
|
10635
10654
|
regulatoryReports = new RegulatoryReports(this);
|
|
10636
10655
|
reportTemplates = new ReportTemplates(this);
|
|
10656
|
+
sandbox = new Sandbox(this);
|
|
10637
10657
|
sessions = new Sessions(this);
|
|
10638
10658
|
transactions = new Transactions(this);
|
|
10639
10659
|
travelRule = new TravelRule(this);
|
|
@@ -11231,6 +11251,8 @@ var JWKS_PATH = ".well-known/jwks.json";
|
|
|
11231
11251
|
var TOKEN_PATH = "token/";
|
|
11232
11252
|
var SESSION_PATH = "session/";
|
|
11233
11253
|
var STEP_UP_PATH = "step-up/";
|
|
11254
|
+
var AGENT_CONSENT_PATH = "agents/consent/";
|
|
11255
|
+
var AGENT_CONSENT_PASSKEY_PATH = "agents/consent/passkey/";
|
|
11234
11256
|
var DECIMAL_TEXT = /^-?[0-9]+(\.[0-9]+)?$/;
|
|
11235
11257
|
function fieldsOf(value) {
|
|
11236
11258
|
return value ?? {};
|
|
@@ -11249,6 +11271,18 @@ function bearerToken(value, name) {
|
|
|
11249
11271
|
}
|
|
11250
11272
|
return token;
|
|
11251
11273
|
}
|
|
11274
|
+
function textList(value, name) {
|
|
11275
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
|
|
11276
|
+
throw new TypeError(`${name} must be a list of strings.`);
|
|
11277
|
+
}
|
|
11278
|
+
return [...value];
|
|
11279
|
+
}
|
|
11280
|
+
function assertionSecrets(value) {
|
|
11281
|
+
if (typeof value === "string") return value.length > 0 ? [value] : [];
|
|
11282
|
+
if (Array.isArray(value)) return value.flatMap(assertionSecrets);
|
|
11283
|
+
if (isRecord4(value)) return Object.values(value).flatMap(assertionSecrets);
|
|
11284
|
+
return [];
|
|
11285
|
+
}
|
|
11252
11286
|
function optionalText(value, name) {
|
|
11253
11287
|
if (value === void 0 || value === null) return void 0;
|
|
11254
11288
|
if (typeof value !== "string") throw new TypeError(`${name} must be a string.`);
|
|
@@ -11501,6 +11535,66 @@ var Authentication = class _Authentication {
|
|
|
11501
11535
|
const path = `${STEP_UP_PATH}${pathSegment(id, "id")}/`;
|
|
11502
11536
|
return await this.#object(this.#bearerCall("GET", path, token));
|
|
11503
11537
|
}
|
|
11538
|
+
/**
|
|
11539
|
+
* Approve or deny an agent's access request (`POST agents/consent/`) with a
|
|
11540
|
+
* token of the signed-in person. Approval returns `{ code, redirect_uri,
|
|
11541
|
+
* state }` (the agent exchanges the single-use code, valid 60 seconds, itself;
|
|
11542
|
+
* no token is returned here); denial returns `{ status: "denied" }`. Tell them
|
|
11543
|
+
* apart with `"code" in result`. A POST: never retried. The `challenge` and
|
|
11544
|
+
* the `assertion` are never logged and are removed from error messages.
|
|
11545
|
+
* Typical failures: 400 `invalid_grant` (unknown or expired request) and 403
|
|
11546
|
+
* `passkey_required` (humans-only application: call
|
|
11547
|
+
* `createAgentApprovalOptions`, run the passkey ceremony, pass the assertion).
|
|
11548
|
+
*/
|
|
11549
|
+
async submitAgentConsent(accessToken, params) {
|
|
11550
|
+
const token = bearerToken(accessToken, "accessToken");
|
|
11551
|
+
const given = fieldsOf(params);
|
|
11552
|
+
const challenge = requiredText(given.challenge, "challenge");
|
|
11553
|
+
const decision = requiredText(given.decision, "decision");
|
|
11554
|
+
if (decision !== "approve" && decision !== "deny") {
|
|
11555
|
+
throw new TypeError('decision must be "approve" or "deny".');
|
|
11556
|
+
}
|
|
11557
|
+
const body = { challenge, decision };
|
|
11558
|
+
const secrets = [token, challenge];
|
|
11559
|
+
const assertion = given.assertion;
|
|
11560
|
+
if (assertion !== void 0 && assertion !== null) {
|
|
11561
|
+
if (!isRecord4(assertion)) throw new TypeError("assertion must be an object.");
|
|
11562
|
+
body.assertion = assertion;
|
|
11563
|
+
secrets.push(...assertionSecrets(assertion));
|
|
11564
|
+
}
|
|
11565
|
+
const scopes = given.scopes;
|
|
11566
|
+
if (scopes !== void 0 && scopes !== null) body.scopes = textList(scopes, "scopes");
|
|
11567
|
+
const organizationIds = given.organizationIds;
|
|
11568
|
+
if (organizationIds !== void 0 && organizationIds !== null) {
|
|
11569
|
+
body.organization_ids = textList(organizationIds, "organizationIds");
|
|
11570
|
+
}
|
|
11571
|
+
const lifetime = given.lifetime;
|
|
11572
|
+
if (lifetime !== void 0 && lifetime !== null) {
|
|
11573
|
+
if (typeof lifetime !== "number" || !Number.isInteger(lifetime)) {
|
|
11574
|
+
throw new TypeError("lifetime must be an integer number of seconds.");
|
|
11575
|
+
}
|
|
11576
|
+
body.lifetime = lifetime;
|
|
11577
|
+
}
|
|
11578
|
+
const call = { ...this.#bearerCall("POST", AGENT_CONSENT_PATH, token), json: body, secrets };
|
|
11579
|
+
return await this.#object(call);
|
|
11580
|
+
}
|
|
11581
|
+
/**
|
|
11582
|
+
* Get WebAuthn request options bound to a pending agent request
|
|
11583
|
+
* (`POST agents/consent/passkey/`) with a token of the signed-in person. Pass
|
|
11584
|
+
* `options` to `navigator.credentials.get()` (decode the base64url fields),
|
|
11585
|
+
* then send the result as `assertion` to `submitAgentConsent`. A POST: never
|
|
11586
|
+
* retried; the `challenge` is never logged.
|
|
11587
|
+
*/
|
|
11588
|
+
async createAgentApprovalOptions(accessToken, params) {
|
|
11589
|
+
const token = bearerToken(accessToken, "accessToken");
|
|
11590
|
+
const challenge = requiredText(fieldsOf(params).challenge, "challenge");
|
|
11591
|
+
const call = {
|
|
11592
|
+
...this.#bearerCall("POST", AGENT_CONSENT_PASSKEY_PATH, token),
|
|
11593
|
+
json: { challenge },
|
|
11594
|
+
secrets: [token, challenge]
|
|
11595
|
+
};
|
|
11596
|
+
return await this.#object(call);
|
|
11597
|
+
}
|
|
11504
11598
|
// Requests ------------------------------------------------------------------
|
|
11505
11599
|
#url(path) {
|
|
11506
11600
|
return `${this.issuer}/${path}`;
|
|
@@ -11686,6 +11780,6 @@ function createNonce() {
|
|
|
11686
11780
|
// src/index.ts
|
|
11687
11781
|
var index_default = Didit;
|
|
11688
11782
|
|
|
11689
|
-
export { APIConnectionError, APIPromise, APIResponseValidationError, APIStatusError, APITimeoutError, Account, AccountApplications, AccountOrganizations, AddressValidation, AgeEstimation, Aml, AmlMonitoring, Analytics, Authentication, AuthenticationError, BadRequestError, Bank, Billing, BiometricTemplates, Blocklist, BusinessSessions, Businesses, Cases, CasesBlueprints, CasesChecklist, CasesLinks, CasesNotes, CasesRegulatoryReports, CasesRequests, CasesRoutingRules, CasesTeams, ConfigurationError, ConflictError, Customization, DEFAULT_ACCOUNT_BASE_URL, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, DEFAULT_WEBHOOK_TOLERANCE, DatabaseValidation, Didit, DiditError, DiditResources, DocumentAi, Email, FaceMatch, FaceSearch, FraudChecks, IdVerification, IdWallets, InternalServerError, Investigator, Ip, Kyb, Lists, ListsEntries, MonitoringEvents, Networks, NetworksNotes, NotFoundError, PagePromise, PassiveLiveness, PermissionDeniedError, Phone, Pricing, ProofOfAddress, Questionnaires, RateLimitError, RegulatoryReports, ReportTemplates, Sessions, SessionsImports, SessionsReviews, SessionsSignatures, SessionsWebhooks, TokenVerificationError, Transactions, TransactionsNotes, TransactionsRules, TransactionsTravelRule, TravelRule, TravelRuleCounterpartyContacts, TravelRuleNetworks, TravelRuleTransfers, TravelRuleUnmatchedDeposits, TravelRuleWalletAddresses, TravelRuleWalletProofs, TravelRuleWorkspaceResource, UnprocessableEntityError, Users, VERSION, WalletScreening, WebhookVerificationError, Webhooks, WebhooksDestinations, Workflows, canonicalJson, createNonce, createPkce, createState, index_default as default, fileFromPath, parsePublishableKey, toFile, verifyWebhook, verifyWebhookParsed, webhooks };
|
|
11783
|
+
export { APIConnectionError, APIPromise, APIResponseValidationError, APIStatusError, APITimeoutError, Account, AccountApplications, AccountOrganizations, AddressValidation, AgeEstimation, Aml, AmlMonitoring, Analytics, Authentication, AuthenticationError, BadRequestError, Bank, Billing, BiometricTemplates, Blocklist, BusinessSessions, Businesses, Cases, CasesBlueprints, CasesChecklist, CasesLinks, CasesNotes, CasesRegulatoryReports, CasesRequests, CasesRoutingRules, CasesTeams, ConfigurationError, ConflictError, Customization, DEFAULT_ACCOUNT_BASE_URL, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, DEFAULT_WEBHOOK_TOLERANCE, DatabaseValidation, Didit, DiditError, DiditResources, DocumentAi, Email, FaceMatch, FaceSearch, FraudChecks, IdVerification, IdWallets, InternalServerError, Investigator, Ip, Kyb, Lists, ListsEntries, MonitoringEvents, Networks, NetworksNotes, NotFoundError, PagePromise, PassiveLiveness, PermissionDeniedError, Phone, Pricing, ProofOfAddress, Questionnaires, RateLimitError, RegulatoryReports, ReportTemplates, Sandbox, Sessions, SessionsImports, SessionsReviews, SessionsSignatures, SessionsWebhooks, TokenVerificationError, Transactions, TransactionsNotes, TransactionsRules, TransactionsTravelRule, TravelRule, TravelRuleCounterpartyContacts, TravelRuleNetworks, TravelRuleTransfers, TravelRuleUnmatchedDeposits, TravelRuleWalletAddresses, TravelRuleWalletProofs, TravelRuleWorkspaceResource, UnprocessableEntityError, Users, VERSION, WalletScreening, WebhookVerificationError, Webhooks, WebhooksDestinations, Workflows, canonicalJson, createNonce, createPkce, createState, index_default as default, fileFromPath, parsePublishableKey, toFile, verifyWebhook, verifyWebhookParsed, webhooks };
|
|
11690
11784
|
//# sourceMappingURL=index.js.map
|
|
11691
11785
|
//# sourceMappingURL=index.js.map
|