@didit-protocol/sdk-node 2.9.0 → 2.11.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/README.md +1 -0
- package/dist/index.cjs +128 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +391 -24
- package/dist/index.d.ts +391 -24
- package/dist/index.js +128 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -307,6 +307,7 @@ try {
|
|
|
307
307
|
- `refresh(refreshToken)`: serialise refreshes for one session; reusing a consumed refresh token revokes the session.
|
|
308
308
|
- `getSession(accessToken)` for an instant revocation check, `revokeSession(accessToken)`.
|
|
309
309
|
- `createStepUp(accessToken, { action, amount?, currency?, returnTo? })` and `retrieveStepUp(accessToken, id)`: act only on status `approved`. The issuer currently requires `returnTo` and answers 400 without it.
|
|
310
|
+
- `submitAgentConsent(accessToken, { challenge, decision, assertion?, scopes?, organizationIds?, lifetime? })` approves or denies an agent request (approval returns `{ code, redirect_uri, state }`, denial `{ status: "denied" }`; test `"code" in result`) and `createAgentApprovalOptions(accessToken, { challenge })` returns the WebAuthn `options` for the fresh passkey assertion a humans-only application requires (403 `passkey_required` without it). Neither is retried; the challenge and assertion are never logged.
|
|
310
311
|
|
|
311
312
|
Authentication is in early access and reaches production with the 2026-11-01 Didit release.
|
|
312
313
|
|
package/dist/index.cjs
CHANGED
|
@@ -282,7 +282,7 @@ function decodeDates(value, plan, named, depth = 0) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
// src/core/version.ts
|
|
285
|
-
var VERSION = "2.
|
|
285
|
+
var VERSION = "2.11.0";
|
|
286
286
|
|
|
287
287
|
// src/core/runtime.ts
|
|
288
288
|
function processLike() {
|
|
@@ -1175,6 +1175,7 @@ var DATE_PLANS = {
|
|
|
1175
1175
|
},
|
|
1176
1176
|
AddressValidationResponse: { p: { created_at: 1 } },
|
|
1177
1177
|
AgeEstimationEstimateResponse: { p: { created_at: 1 } },
|
|
1178
|
+
AgentTopUp: { p: { created_at: 1 } },
|
|
1178
1179
|
AmlMonitoringRetrieveJobResponse: { p: { created_at: 1, completed_at: 1 } },
|
|
1179
1180
|
AmlRetrieveDatasetFreshnessResponse: { p: { dataset_freshness: "AMLDatasetFreshness" } },
|
|
1180
1181
|
AmlScreenResponse: {
|
|
@@ -1192,6 +1193,7 @@ var DATE_PLANS = {
|
|
|
1192
1193
|
updated_at: 1
|
|
1193
1194
|
}
|
|
1194
1195
|
},
|
|
1196
|
+
BillingTopUpCharge: { p: { top_up: "AgentTopUp" } },
|
|
1195
1197
|
BiometricRetention: { p: { deletes_at: 1 } },
|
|
1196
1198
|
BiometricTemplatesListResponse: {
|
|
1197
1199
|
p: { results: { i: { p: { retained_at: 1, expires_at: 1, purged_at: 1 } } } }
|
|
@@ -1950,6 +1952,8 @@ var AccountApplications = class extends APIResource {
|
|
|
1950
1952
|
*
|
|
1951
1953
|
* 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.
|
|
1952
1954
|
*
|
|
1955
|
+
* 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.
|
|
1956
|
+
*
|
|
1953
1957
|
* `POST /organizations/me/{org_id}/applications/`
|
|
1954
1958
|
*
|
|
1955
1959
|
* @param orgId UUID of the organization. Look it up with `GET /organizations/me/`.
|
|
@@ -1987,6 +1991,8 @@ var AccountApplications = class extends APIResource {
|
|
|
1987
1991
|
*
|
|
1988
1992
|
* 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.
|
|
1989
1993
|
*
|
|
1994
|
+
* 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.
|
|
1995
|
+
*
|
|
1990
1996
|
* `PATCH /organizations/me/{org_id}/applications/{app_id}/`
|
|
1991
1997
|
*
|
|
1992
1998
|
* @param orgId UUID of the organization that owns the application.
|
|
@@ -2287,7 +2293,12 @@ var Bank = class extends APIResource {
|
|
|
2287
2293
|
|
|
2288
2294
|
// src/resources/billing.ts
|
|
2289
2295
|
var BILLING_RETRIEVE_BALANCE = { method: "GET", path: "/v3/billing/balance/" };
|
|
2290
|
-
var BILLING_TOP_UP = {
|
|
2296
|
+
var BILLING_TOP_UP = {
|
|
2297
|
+
method: "POST",
|
|
2298
|
+
path: "/v3/billing/top-up/",
|
|
2299
|
+
body: "json",
|
|
2300
|
+
dates: "BillingTopUpCharge"
|
|
2301
|
+
};
|
|
2291
2302
|
var Billing = class extends APIResource {
|
|
2292
2303
|
/**
|
|
2293
2304
|
* Get credit balance
|
|
@@ -2302,9 +2313,24 @@ var Billing = class extends APIResource {
|
|
|
2302
2313
|
/**
|
|
2303
2314
|
* Top up credits
|
|
2304
2315
|
*
|
|
2305
|
-
* Add credits
|
|
2316
|
+
* Add credits to the organization's balance (**\$50 to \$20,000** per top-up). Top-ups are available on the Free, Growth and Scale plans, added at face value with no discount or bonus, and last 12 months; Enterprise annual contracts cannot top up.
|
|
2317
|
+
*
|
|
2318
|
+
* Two payment methods, chosen with `payment_method`:
|
|
2319
|
+
*
|
|
2320
|
+
* - `checkout` (default): creates a hosted Stripe Checkout session. Redirect the customer to the returned `checkout_session_url` (`200`).
|
|
2321
|
+
* - `saved_card`: charges the organization's saved primary card off-session, now, at the normal self-serve amounts. Send an `Idempotency-Key` header (required for this method). It answers `201` when the card was charged, and `202` when a request with the same key is still being processed.
|
|
2322
|
+
*
|
|
2323
|
+
* **Agent top-ups (`saved_card`).** One switch controls them: "Connected AI agents can top up with your saved card". It is off by default and only a person signed in to the console can turn it on (Billing > Payment methods), never an API key or an agent. While it is on, agents and API keys can top up with the primary saved card. When it is off, the request returns `403` `agent_top_up_not_enabled` with a link a person can use to top up in the console.
|
|
2324
|
+
*
|
|
2325
|
+
* The balance is credited once the payment is confirmed, usually within seconds, and tax is added to the amount charged when it applies, so `total` can be higher than `credit_amount`. Read `GET /v3/billing/balance/` to confirm.
|
|
2326
|
+
*
|
|
2327
|
+
* **Idempotency.** Retrying with the same `Idempotency-Key` and the same amount returns the same top-up and never charges twice. The same key with another amount returns `409` `idempotency_key_conflict`.
|
|
2328
|
+
*
|
|
2329
|
+
* Every error of a `saved_card` request carries a `code` and a `detail`, and most also a `next_step` (read it only when it is present). When the step needs a person (for example `authentication_required`, where the card's bank asks the cardholder to approve and nothing is charged), `next_step.url` is a signed link to the console that opens the Top up dialog with the amount filled in and says which agent asked; nothing is charged until the person pays. Each top-up is marked with the agent's name in billing history and in the ordinary receipt email.
|
|
2306
2330
|
*
|
|
2307
2331
|
* `POST /v3/billing/top-up/`
|
|
2332
|
+
*
|
|
2333
|
+
* Accepts `options.idempotencyKey` (header `Idempotency-Key`).
|
|
2308
2334
|
*/
|
|
2309
2335
|
topUp(params, options) {
|
|
2310
2336
|
return this._client.request(BILLING_TOP_UP, [], params, options);
|
|
@@ -3482,7 +3508,7 @@ var CasesRegulatoryReports = class extends APIResource {
|
|
|
3482
3508
|
/**
|
|
3483
3509
|
* Create report from case
|
|
3484
3510
|
*
|
|
3485
|
-
* Create a draft FIU report for the case: DRAFT status, auto-populated from the optional template plus the case's subject, linked transactions, and narrative. Validate then finalize to produce the goAML XML and PDF.
|
|
3511
|
+
* Create a draft FIU report for the case: DRAFT status, auto-populated from the optional template plus the case's subject, linked transactions, and narrative. Validate then finalize to produce the goAML XML and PDF. FFR (Confirmed Name Match Report, formerly the Funds Freeze Report) and PNMR (Partial Name Match Report) are activity reports: they report the case's subject, not transactions, so a draft links no transactions by default and the narrative, reason and action are written from the sanctions matches on the case's AML screenings.
|
|
3486
3512
|
*
|
|
3487
3513
|
* `POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/regulatory-reports/`
|
|
3488
3514
|
*
|
|
@@ -6335,7 +6361,7 @@ var RegulatoryReports = class extends APIResource {
|
|
|
6335
6361
|
/**
|
|
6336
6362
|
* Finalize report
|
|
6337
6363
|
*
|
|
6338
|
-
* Re-validate, then render the goAML XML and PDF and upload both to S3. On SAR/STR/TFR reports, this also moves the case's transaction alerts from Pending SAR to SAR filed.
|
|
6364
|
+
* Re-validate, then render the goAML XML and PDF and upload both to S3. On SAR/STR/TFR reports, this also moves the case's transaction alerts from Pending SAR to SAR filed. FFR and PNMR reports do not move alerts.
|
|
6339
6365
|
*
|
|
6340
6366
|
* `POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/`
|
|
6341
6367
|
*
|
|
@@ -6398,7 +6424,7 @@ var RegulatoryReports = class extends APIResource {
|
|
|
6398
6424
|
/**
|
|
6399
6425
|
* Validate report
|
|
6400
6426
|
*
|
|
6401
|
-
* Check the report against the obligatory goAML header fields (reporting entity ID, submission code, local currency, action taken, submission date), plus at least one attached transaction and a 2-letter jurisdiction, without generating any files. Also stores the result on the report: validation_errors and validated_at are updated, and a non-finalized report's status moves to VALIDATED (no errors) or back to DRAFT (errors).
|
|
6427
|
+
* Check the report against the obligatory goAML header fields (reporting entity ID, submission code, local currency, action taken, submission date), plus at least one attached transaction and a 2-letter jurisdiction, without generating any files. For jurisdiction AE, once those pass, the report's goAML XML is also checked against the UAE FIU's goAML XML schema and each problem is returned as a field and a message; finalize refuses a report that fails. FFR and PNMR reports need no attached transaction: they require the case to have a subject, otherwise validation_errors contains an error with field `subject`. Also stores the result on the report: validation_errors and validated_at are updated, and a non-finalized report's status moves to VALIDATED (no errors) or back to DRAFT (errors).
|
|
6402
6428
|
*
|
|
6403
6429
|
* `POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/validate/`
|
|
6404
6430
|
*
|
|
@@ -6502,6 +6528,21 @@ var ReportTemplates = class extends APIResource {
|
|
|
6502
6528
|
}
|
|
6503
6529
|
};
|
|
6504
6530
|
|
|
6531
|
+
// src/resources/sandbox.ts
|
|
6532
|
+
var SANDBOX_LIST_SCENARIOS = { method: "GET", path: "/v1/sandbox/scenarios/" };
|
|
6533
|
+
var Sandbox = class extends APIResource {
|
|
6534
|
+
/**
|
|
6535
|
+
* List sandbox scenarios and Test VASP metadata
|
|
6536
|
+
*
|
|
6537
|
+
* 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).
|
|
6538
|
+
*
|
|
6539
|
+
* `GET /v1/sandbox/scenarios/`
|
|
6540
|
+
*/
|
|
6541
|
+
listScenarios(options) {
|
|
6542
|
+
return this._client.request(SANDBOX_LIST_SCENARIOS, [], void 0, options);
|
|
6543
|
+
}
|
|
6544
|
+
};
|
|
6545
|
+
|
|
6505
6546
|
// src/resources/sessions.ts
|
|
6506
6547
|
var SESSIONS_IMPORTS_CANCEL = {
|
|
6507
6548
|
method: "POST",
|
|
@@ -10616,6 +10657,7 @@ var DiditResources = class extends APIClient {
|
|
|
10616
10657
|
questionnaires = new Questionnaires(this);
|
|
10617
10658
|
regulatoryReports = new RegulatoryReports(this);
|
|
10618
10659
|
reportTemplates = new ReportTemplates(this);
|
|
10660
|
+
sandbox = new Sandbox(this);
|
|
10619
10661
|
sessions = new Sessions(this);
|
|
10620
10662
|
transactions = new Transactions(this);
|
|
10621
10663
|
travelRule = new TravelRule(this);
|
|
@@ -11213,6 +11255,8 @@ var JWKS_PATH = ".well-known/jwks.json";
|
|
|
11213
11255
|
var TOKEN_PATH = "token/";
|
|
11214
11256
|
var SESSION_PATH = "session/";
|
|
11215
11257
|
var STEP_UP_PATH = "step-up/";
|
|
11258
|
+
var AGENT_CONSENT_PATH = "agents/consent/";
|
|
11259
|
+
var AGENT_CONSENT_PASSKEY_PATH = "agents/consent/passkey/";
|
|
11216
11260
|
var DECIMAL_TEXT = /^-?[0-9]+(\.[0-9]+)?$/;
|
|
11217
11261
|
function fieldsOf(value) {
|
|
11218
11262
|
return value ?? {};
|
|
@@ -11231,6 +11275,23 @@ function bearerToken(value, name) {
|
|
|
11231
11275
|
}
|
|
11232
11276
|
return token;
|
|
11233
11277
|
}
|
|
11278
|
+
function textList(value, name) {
|
|
11279
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
|
|
11280
|
+
throw new TypeError(`${name} must be a list of strings.`);
|
|
11281
|
+
}
|
|
11282
|
+
return [...value];
|
|
11283
|
+
}
|
|
11284
|
+
function assertionSecrets(assertion) {
|
|
11285
|
+
const response = isRecord4(assertion.response) ? assertion.response : {};
|
|
11286
|
+
return [
|
|
11287
|
+
assertion.id,
|
|
11288
|
+
assertion.rawId,
|
|
11289
|
+
response.clientDataJSON,
|
|
11290
|
+
response.authenticatorData,
|
|
11291
|
+
response.signature,
|
|
11292
|
+
response.userHandle
|
|
11293
|
+
].filter((value) => typeof value === "string" && value.length > 0);
|
|
11294
|
+
}
|
|
11234
11295
|
function optionalText(value, name) {
|
|
11235
11296
|
if (value === void 0 || value === null) return void 0;
|
|
11236
11297
|
if (typeof value !== "string") throw new TypeError(`${name} must be a string.`);
|
|
@@ -11483,6 +11544,66 @@ var Authentication = class _Authentication {
|
|
|
11483
11544
|
const path = `${STEP_UP_PATH}${pathSegment(id, "id")}/`;
|
|
11484
11545
|
return await this.#object(this.#bearerCall("GET", path, token));
|
|
11485
11546
|
}
|
|
11547
|
+
/**
|
|
11548
|
+
* Approve or deny an agent's access request (`POST agents/consent/`) with a
|
|
11549
|
+
* token of the signed-in person. Approval returns `{ code, redirect_uri,
|
|
11550
|
+
* state }` (the agent exchanges the single-use code, valid 60 seconds, itself;
|
|
11551
|
+
* no token is returned here); denial returns `{ status: "denied" }`. Tell them
|
|
11552
|
+
* apart with `"code" in result`. A POST: never retried. The `challenge` and
|
|
11553
|
+
* the `assertion` are never logged and are removed from error messages.
|
|
11554
|
+
* Typical failures: 400 `invalid_grant` (unknown or expired request) and 403
|
|
11555
|
+
* `passkey_required` (humans-only application: call
|
|
11556
|
+
* `createAgentApprovalOptions`, run the passkey ceremony, pass the assertion).
|
|
11557
|
+
*/
|
|
11558
|
+
async submitAgentConsent(accessToken, params) {
|
|
11559
|
+
const token = bearerToken(accessToken, "accessToken");
|
|
11560
|
+
const given = fieldsOf(params);
|
|
11561
|
+
const challenge = requiredText(given.challenge, "challenge");
|
|
11562
|
+
const decision = requiredText(given.decision, "decision");
|
|
11563
|
+
if (decision !== "approve" && decision !== "deny") {
|
|
11564
|
+
throw new TypeError('decision must be "approve" or "deny".');
|
|
11565
|
+
}
|
|
11566
|
+
const body = { challenge, decision };
|
|
11567
|
+
const secrets = [token, challenge];
|
|
11568
|
+
const assertion = given.assertion;
|
|
11569
|
+
if (assertion !== void 0 && assertion !== null) {
|
|
11570
|
+
if (!isRecord4(assertion)) throw new TypeError("assertion must be an object.");
|
|
11571
|
+
body.assertion = assertion;
|
|
11572
|
+
secrets.push(...assertionSecrets(assertion));
|
|
11573
|
+
}
|
|
11574
|
+
const scopes = given.scopes;
|
|
11575
|
+
if (scopes !== void 0 && scopes !== null) body.scopes = textList(scopes, "scopes");
|
|
11576
|
+
const organizationIds = given.organizationIds;
|
|
11577
|
+
if (organizationIds !== void 0 && organizationIds !== null) {
|
|
11578
|
+
body.organization_ids = textList(organizationIds, "organizationIds");
|
|
11579
|
+
}
|
|
11580
|
+
const lifetime = given.lifetime;
|
|
11581
|
+
if (lifetime !== void 0 && lifetime !== null) {
|
|
11582
|
+
if (typeof lifetime !== "number" || !Number.isInteger(lifetime)) {
|
|
11583
|
+
throw new TypeError("lifetime must be an integer number of seconds.");
|
|
11584
|
+
}
|
|
11585
|
+
body.lifetime = lifetime;
|
|
11586
|
+
}
|
|
11587
|
+
const call = { ...this.#bearerCall("POST", AGENT_CONSENT_PATH, token), json: body, secrets };
|
|
11588
|
+
return await this.#object(call);
|
|
11589
|
+
}
|
|
11590
|
+
/**
|
|
11591
|
+
* Get WebAuthn request options bound to a pending agent request
|
|
11592
|
+
* (`POST agents/consent/passkey/`) with a token of the signed-in person. Pass
|
|
11593
|
+
* `options` to `navigator.credentials.get()` (decode the base64url fields),
|
|
11594
|
+
* then send the result as `assertion` to `submitAgentConsent`. A POST: never
|
|
11595
|
+
* retried; the `challenge` is never logged.
|
|
11596
|
+
*/
|
|
11597
|
+
async createAgentApprovalOptions(accessToken, params) {
|
|
11598
|
+
const token = bearerToken(accessToken, "accessToken");
|
|
11599
|
+
const challenge = requiredText(fieldsOf(params).challenge, "challenge");
|
|
11600
|
+
const call = {
|
|
11601
|
+
...this.#bearerCall("POST", AGENT_CONSENT_PASSKEY_PATH, token),
|
|
11602
|
+
json: { challenge },
|
|
11603
|
+
secrets: [token, challenge]
|
|
11604
|
+
};
|
|
11605
|
+
return await this.#object(call);
|
|
11606
|
+
}
|
|
11486
11607
|
// Requests ------------------------------------------------------------------
|
|
11487
11608
|
#url(path) {
|
|
11488
11609
|
return `${this.issuer}/${path}`;
|
|
@@ -11738,6 +11859,7 @@ exports.Questionnaires = Questionnaires;
|
|
|
11738
11859
|
exports.RateLimitError = RateLimitError;
|
|
11739
11860
|
exports.RegulatoryReports = RegulatoryReports;
|
|
11740
11861
|
exports.ReportTemplates = ReportTemplates;
|
|
11862
|
+
exports.Sandbox = Sandbox;
|
|
11741
11863
|
exports.Sessions = Sessions;
|
|
11742
11864
|
exports.SessionsImports = SessionsImports;
|
|
11743
11865
|
exports.SessionsReviews = SessionsReviews;
|