@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/dist/index.js CHANGED
@@ -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.9.0";
281
+ var VERSION = "2.11.0";
282
282
 
283
283
  // src/core/runtime.ts
284
284
  function processLike() {
@@ -1171,6 +1171,7 @@ var DATE_PLANS = {
1171
1171
  },
1172
1172
  AddressValidationResponse: { p: { created_at: 1 } },
1173
1173
  AgeEstimationEstimateResponse: { p: { created_at: 1 } },
1174
+ AgentTopUp: { p: { created_at: 1 } },
1174
1175
  AmlMonitoringRetrieveJobResponse: { p: { created_at: 1, completed_at: 1 } },
1175
1176
  AmlRetrieveDatasetFreshnessResponse: { p: { dataset_freshness: "AMLDatasetFreshness" } },
1176
1177
  AmlScreenResponse: {
@@ -1188,6 +1189,7 @@ var DATE_PLANS = {
1188
1189
  updated_at: 1
1189
1190
  }
1190
1191
  },
1192
+ BillingTopUpCharge: { p: { top_up: "AgentTopUp" } },
1191
1193
  BiometricRetention: { p: { deletes_at: 1 } },
1192
1194
  BiometricTemplatesListResponse: {
1193
1195
  p: { results: { i: { p: { retained_at: 1, expires_at: 1, purged_at: 1 } } } }
@@ -1946,6 +1948,8 @@ var AccountApplications = class extends APIResource {
1946
1948
  *
1947
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.
1948
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
+ *
1949
1953
  * `POST /organizations/me/{org_id}/applications/`
1950
1954
  *
1951
1955
  * @param orgId UUID of the organization. Look it up with `GET /organizations/me/`.
@@ -1983,6 +1987,8 @@ var AccountApplications = class extends APIResource {
1983
1987
  *
1984
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.
1985
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
+ *
1986
1992
  * `PATCH /organizations/me/{org_id}/applications/{app_id}/`
1987
1993
  *
1988
1994
  * @param orgId UUID of the organization that owns the application.
@@ -2283,7 +2289,12 @@ var Bank = class extends APIResource {
2283
2289
 
2284
2290
  // src/resources/billing.ts
2285
2291
  var BILLING_RETRIEVE_BALANCE = { method: "GET", path: "/v3/billing/balance/" };
2286
- var BILLING_TOP_UP = { method: "POST", path: "/v3/billing/top-up/", body: "json" };
2292
+ var BILLING_TOP_UP = {
2293
+ method: "POST",
2294
+ path: "/v3/billing/top-up/",
2295
+ body: "json",
2296
+ dates: "BillingTopUpCharge"
2297
+ };
2287
2298
  var Billing = class extends APIResource {
2288
2299
  /**
2289
2300
  * Get credit balance
@@ -2298,9 +2309,24 @@ var Billing = class extends APIResource {
2298
2309
  /**
2299
2310
  * Top up credits
2300
2311
  *
2301
- * Add credits via a hosted Stripe Checkout session (**\$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. Redirect the customer to the returned `checkout_session_url`.
2312
+ * 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.
2313
+ *
2314
+ * Two payment methods, chosen with `payment_method`:
2315
+ *
2316
+ * - `checkout` (default): creates a hosted Stripe Checkout session. Redirect the customer to the returned `checkout_session_url` (`200`).
2317
+ * - `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.
2318
+ *
2319
+ * **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.
2320
+ *
2321
+ * 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.
2322
+ *
2323
+ * **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`.
2324
+ *
2325
+ * 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.
2302
2326
  *
2303
2327
  * `POST /v3/billing/top-up/`
2328
+ *
2329
+ * Accepts `options.idempotencyKey` (header `Idempotency-Key`).
2304
2330
  */
2305
2331
  topUp(params, options) {
2306
2332
  return this._client.request(BILLING_TOP_UP, [], params, options);
@@ -3478,7 +3504,7 @@ var CasesRegulatoryReports = class extends APIResource {
3478
3504
  /**
3479
3505
  * Create report from case
3480
3506
  *
3481
- * 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.
3507
+ * 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.
3482
3508
  *
3483
3509
  * `POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/regulatory-reports/`
3484
3510
  *
@@ -6331,7 +6357,7 @@ var RegulatoryReports = class extends APIResource {
6331
6357
  /**
6332
6358
  * Finalize report
6333
6359
  *
6334
- * 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.
6360
+ * 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.
6335
6361
  *
6336
6362
  * `POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/`
6337
6363
  *
@@ -6394,7 +6420,7 @@ var RegulatoryReports = class extends APIResource {
6394
6420
  /**
6395
6421
  * Validate report
6396
6422
  *
6397
- * 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).
6423
+ * 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).
6398
6424
  *
6399
6425
  * `POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/validate/`
6400
6426
  *
@@ -6498,6 +6524,21 @@ var ReportTemplates = class extends APIResource {
6498
6524
  }
6499
6525
  };
6500
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
+
6501
6542
  // src/resources/sessions.ts
6502
6543
  var SESSIONS_IMPORTS_CANCEL = {
6503
6544
  method: "POST",
@@ -10612,6 +10653,7 @@ var DiditResources = class extends APIClient {
10612
10653
  questionnaires = new Questionnaires(this);
10613
10654
  regulatoryReports = new RegulatoryReports(this);
10614
10655
  reportTemplates = new ReportTemplates(this);
10656
+ sandbox = new Sandbox(this);
10615
10657
  sessions = new Sessions(this);
10616
10658
  transactions = new Transactions(this);
10617
10659
  travelRule = new TravelRule(this);
@@ -11209,6 +11251,8 @@ var JWKS_PATH = ".well-known/jwks.json";
11209
11251
  var TOKEN_PATH = "token/";
11210
11252
  var SESSION_PATH = "session/";
11211
11253
  var STEP_UP_PATH = "step-up/";
11254
+ var AGENT_CONSENT_PATH = "agents/consent/";
11255
+ var AGENT_CONSENT_PASSKEY_PATH = "agents/consent/passkey/";
11212
11256
  var DECIMAL_TEXT = /^-?[0-9]+(\.[0-9]+)?$/;
11213
11257
  function fieldsOf(value) {
11214
11258
  return value ?? {};
@@ -11227,6 +11271,23 @@ function bearerToken(value, name) {
11227
11271
  }
11228
11272
  return token;
11229
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(assertion) {
11281
+ const response = isRecord4(assertion.response) ? assertion.response : {};
11282
+ return [
11283
+ assertion.id,
11284
+ assertion.rawId,
11285
+ response.clientDataJSON,
11286
+ response.authenticatorData,
11287
+ response.signature,
11288
+ response.userHandle
11289
+ ].filter((value) => typeof value === "string" && value.length > 0);
11290
+ }
11230
11291
  function optionalText(value, name) {
11231
11292
  if (value === void 0 || value === null) return void 0;
11232
11293
  if (typeof value !== "string") throw new TypeError(`${name} must be a string.`);
@@ -11479,6 +11540,66 @@ var Authentication = class _Authentication {
11479
11540
  const path = `${STEP_UP_PATH}${pathSegment(id, "id")}/`;
11480
11541
  return await this.#object(this.#bearerCall("GET", path, token));
11481
11542
  }
11543
+ /**
11544
+ * Approve or deny an agent's access request (`POST agents/consent/`) with a
11545
+ * token of the signed-in person. Approval returns `{ code, redirect_uri,
11546
+ * state }` (the agent exchanges the single-use code, valid 60 seconds, itself;
11547
+ * no token is returned here); denial returns `{ status: "denied" }`. Tell them
11548
+ * apart with `"code" in result`. A POST: never retried. The `challenge` and
11549
+ * the `assertion` are never logged and are removed from error messages.
11550
+ * Typical failures: 400 `invalid_grant` (unknown or expired request) and 403
11551
+ * `passkey_required` (humans-only application: call
11552
+ * `createAgentApprovalOptions`, run the passkey ceremony, pass the assertion).
11553
+ */
11554
+ async submitAgentConsent(accessToken, params) {
11555
+ const token = bearerToken(accessToken, "accessToken");
11556
+ const given = fieldsOf(params);
11557
+ const challenge = requiredText(given.challenge, "challenge");
11558
+ const decision = requiredText(given.decision, "decision");
11559
+ if (decision !== "approve" && decision !== "deny") {
11560
+ throw new TypeError('decision must be "approve" or "deny".');
11561
+ }
11562
+ const body = { challenge, decision };
11563
+ const secrets = [token, challenge];
11564
+ const assertion = given.assertion;
11565
+ if (assertion !== void 0 && assertion !== null) {
11566
+ if (!isRecord4(assertion)) throw new TypeError("assertion must be an object.");
11567
+ body.assertion = assertion;
11568
+ secrets.push(...assertionSecrets(assertion));
11569
+ }
11570
+ const scopes = given.scopes;
11571
+ if (scopes !== void 0 && scopes !== null) body.scopes = textList(scopes, "scopes");
11572
+ const organizationIds = given.organizationIds;
11573
+ if (organizationIds !== void 0 && organizationIds !== null) {
11574
+ body.organization_ids = textList(organizationIds, "organizationIds");
11575
+ }
11576
+ const lifetime = given.lifetime;
11577
+ if (lifetime !== void 0 && lifetime !== null) {
11578
+ if (typeof lifetime !== "number" || !Number.isInteger(lifetime)) {
11579
+ throw new TypeError("lifetime must be an integer number of seconds.");
11580
+ }
11581
+ body.lifetime = lifetime;
11582
+ }
11583
+ const call = { ...this.#bearerCall("POST", AGENT_CONSENT_PATH, token), json: body, secrets };
11584
+ return await this.#object(call);
11585
+ }
11586
+ /**
11587
+ * Get WebAuthn request options bound to a pending agent request
11588
+ * (`POST agents/consent/passkey/`) with a token of the signed-in person. Pass
11589
+ * `options` to `navigator.credentials.get()` (decode the base64url fields),
11590
+ * then send the result as `assertion` to `submitAgentConsent`. A POST: never
11591
+ * retried; the `challenge` is never logged.
11592
+ */
11593
+ async createAgentApprovalOptions(accessToken, params) {
11594
+ const token = bearerToken(accessToken, "accessToken");
11595
+ const challenge = requiredText(fieldsOf(params).challenge, "challenge");
11596
+ const call = {
11597
+ ...this.#bearerCall("POST", AGENT_CONSENT_PASSKEY_PATH, token),
11598
+ json: { challenge },
11599
+ secrets: [token, challenge]
11600
+ };
11601
+ return await this.#object(call);
11602
+ }
11482
11603
  // Requests ------------------------------------------------------------------
11483
11604
  #url(path) {
11484
11605
  return `${this.issuer}/${path}`;
@@ -11664,6 +11785,6 @@ function createNonce() {
11664
11785
  // src/index.ts
11665
11786
  var index_default = Didit;
11666
11787
 
11667
- 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 };
11788
+ 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 };
11668
11789
  //# sourceMappingURL=index.js.map
11669
11790
  //# sourceMappingURL=index.js.map