@vorim/sdk 4.4.0 → 4.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/CHANGELOG.md +26 -0
- package/dist/{_commerce-core-B800cza0.d.cts → _commerce-core-QF7IKCKQ.d.cts} +1 -1
- package/dist/{_commerce-core-Bv_2hfKP.d.ts → _commerce-core-jih7k4hQ.d.ts} +1 -1
- package/dist/index.cjs +253 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +219 -3
- package/dist/index.d.ts +219 -3
- package/dist/index.js +252 -3
- package/dist/index.js.map +1 -1
- package/dist/integrations/amazon.d.cts +2 -2
- package/dist/integrations/amazon.d.ts +2 -2
- package/dist/integrations/anthropic.d.cts +1 -1
- package/dist/integrations/anthropic.d.ts +1 -1
- package/dist/integrations/ap2.d.cts +1 -1
- package/dist/integrations/ap2.d.ts +1 -1
- package/dist/integrations/aws-iam.d.cts +1 -1
- package/dist/integrations/aws-iam.d.ts +1 -1
- package/dist/integrations/bank-rails.d.cts +1 -1
- package/dist/integrations/bank-rails.d.ts +1 -1
- package/dist/integrations/circle.d.cts +1 -1
- package/dist/integrations/circle.d.ts +1 -1
- package/dist/integrations/cloudflare.d.cts +1 -1
- package/dist/integrations/cloudflare.d.ts +1 -1
- package/dist/integrations/coinbase-cdp.d.cts +1 -1
- package/dist/integrations/coinbase-cdp.d.ts +1 -1
- package/dist/integrations/commerce-agents.d.cts +1 -1
- package/dist/integrations/commerce-agents.d.ts +1 -1
- package/dist/integrations/crewai.d.cts +1 -1
- package/dist/integrations/crewai.d.ts +1 -1
- package/dist/integrations/delivery.d.cts +2 -2
- package/dist/integrations/delivery.d.ts +2 -2
- package/dist/integrations/ebay.d.cts +2 -2
- package/dist/integrations/ebay.d.ts +2 -2
- package/dist/integrations/entra.d.cts +1 -1
- package/dist/integrations/entra.d.ts +1 -1
- package/dist/integrations/etsy.d.cts +2 -2
- package/dist/integrations/etsy.d.ts +2 -2
- package/dist/integrations/eu-providers.d.cts +1 -1
- package/dist/integrations/eu-providers.d.ts +1 -1
- package/dist/integrations/fhir.d.cts +1 -1
- package/dist/integrations/fhir.d.ts +1 -1
- package/dist/integrations/google-merchant.d.cts +2 -2
- package/dist/integrations/google-merchant.d.ts +2 -2
- package/dist/integrations/grok.d.cts +1 -1
- package/dist/integrations/grok.d.ts +1 -1
- package/dist/integrations/guidewire.d.cts +1 -1
- package/dist/integrations/guidewire.d.ts +1 -1
- package/dist/integrations/hermes.d.cts +1 -1
- package/dist/integrations/hermes.d.ts +1 -1
- package/dist/integrations/jira.d.cts +1 -1
- package/dist/integrations/jira.d.ts +1 -1
- package/dist/integrations/langchain.d.cts +1 -1
- package/dist/integrations/langchain.d.ts +1 -1
- package/dist/integrations/langgraph.d.cts +1 -1
- package/dist/integrations/langgraph.d.ts +1 -1
- package/dist/integrations/legal.d.cts +1 -1
- package/dist/integrations/legal.d.ts +1 -1
- package/dist/integrations/life-sciences.d.cts +1 -1
- package/dist/integrations/life-sciences.d.ts +1 -1
- package/dist/integrations/linear.d.cts +1 -1
- package/dist/integrations/linear.d.ts +1 -1
- package/dist/integrations/lithic.d.cts +1 -1
- package/dist/integrations/lithic.d.ts +1 -1
- package/dist/integrations/llamaindex.d.cts +1 -1
- package/dist/integrations/llamaindex.d.ts +1 -1
- package/dist/integrations/marqeta.d.cts +1 -1
- package/dist/integrations/marqeta.d.ts +1 -1
- package/dist/integrations/meta.d.cts +2 -2
- package/dist/integrations/meta.d.ts +2 -2
- package/dist/integrations/mistral.d.cts +1 -1
- package/dist/integrations/mistral.d.ts +1 -1
- package/dist/integrations/modern-treasury.d.cts +1 -1
- package/dist/integrations/modern-treasury.d.ts +1 -1
- package/dist/integrations/muse.d.cts +1 -1
- package/dist/integrations/muse.d.ts +1 -1
- package/dist/integrations/nekuda.d.cts +1 -1
- package/dist/integrations/nekuda.d.ts +1 -1
- package/dist/integrations/okta.d.cts +1 -1
- package/dist/integrations/okta.d.ts +1 -1
- package/dist/integrations/openai.d.cts +1 -1
- package/dist/integrations/openai.d.ts +1 -1
- package/dist/integrations/openrouter.d.cts +1 -1
- package/dist/integrations/openrouter.d.ts +1 -1
- package/dist/integrations/paypal-agent.d.cts +1 -1
- package/dist/integrations/paypal-agent.d.ts +1 -1
- package/dist/integrations/perplexity.d.cts +1 -1
- package/dist/integrations/perplexity.d.ts +1 -1
- package/dist/integrations/plaid.d.cts +1 -1
- package/dist/integrations/plaid.d.ts +1 -1
- package/dist/integrations/ramp.d.cts +1 -1
- package/dist/integrations/ramp.d.ts +1 -1
- package/dist/integrations/shopify.d.cts +1 -1
- package/dist/integrations/shopify.d.ts +1 -1
- package/dist/integrations/siem.d.cts +1 -1
- package/dist/integrations/siem.d.ts +1 -1
- package/dist/integrations/skyfire.d.cts +1 -1
- package/dist/integrations/skyfire.d.ts +1 -1
- package/dist/integrations/social-ads.d.cts +2 -2
- package/dist/integrations/social-ads.d.ts +2 -2
- package/dist/integrations/stripe-acp.d.cts +1 -1
- package/dist/integrations/stripe-acp.d.ts +1 -1
- package/dist/integrations/stripe-issuing.d.cts +1 -1
- package/dist/integrations/stripe-issuing.d.ts +1 -1
- package/dist/integrations/tiktok-shop.d.cts +2 -2
- package/dist/integrations/tiktok-shop.d.ts +2 -2
- package/dist/integrations/truanon.d.cts +1 -1
- package/dist/integrations/truanon.d.ts +1 -1
- package/dist/integrations/typesafe.d.cts +1 -1
- package/dist/integrations/typesafe.d.ts +1 -1
- package/dist/integrations/ucp.d.cts +1 -1
- package/dist/integrations/ucp.d.ts +1 -1
- package/dist/integrations/vercel-ai.d.cts +1 -1
- package/dist/integrations/vercel-ai.d.ts +1 -1
- package/dist/integrations/walmart.d.cts +2 -2
- package/dist/integrations/walmart.d.ts +2 -2
- package/dist/integrations/x402.d.cts +1 -1
- package/dist/integrations/x402.d.ts +1 -1
- package/dist/{types-BI7fk5gL.d.cts → types-3hhqtL0W.d.cts} +98 -1
- package/dist/{types-BI7fk5gL.d.ts → types-3hhqtL0W.d.ts} +98 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog — @vorim/sdk
|
|
2
2
|
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **AI incidents and near misses.** `listIncidents({ days? })`, `getIncident(ref)` and `updateIncident(ref, {...})`. Kill-switch stops, tripwires that refused and sign-off packs that got worse each become a record; `getIncident` returns it signed and laid out as the FCA's PS26/2 standard reporting template (`payload.ps26_2`, each field marked as filled by Vorim, by you, or still missing). `updateIncident` records your assessment (status, incident or near miss, triggers, type, severity, cause type from the template's own list, origin, recovery actions). Whether an incident is reportable stays your decision.
|
|
8
|
+
- **Statement of delegated authority.** `getAuthorityStatement(agentId)`: one signed page per agent under the four headings the FCA set out on 19 October 2026 (identity, delegated authority, accountability, execution) and the gaps a reviewer will ask about. Set `metadata.model`, `metadata.provider` and `metadata.smf_owner` (the accountable senior manager) with `updateAgent`.
|
|
9
|
+
- **Visa Trusted Agent Protocol.** `verifyTap({ url, headers, keys?, requireTag? })` checks a TAP message signature on a request your site received: the signature over `@authority` and `@path`, the 8-minute window, the tag (`agent-browser-auth` or `agent-payer-auth`) and a one-time nonce. Built from Visa's merchant specification and sample code; keys come from the key directory your Vorim server is configured with, or the ones you pass.
|
|
10
|
+
- **Mastercard Verifiable Intent.** `importVerifiableIntent({ l1, l2, issuerJwk, agentId, customerRef })` checks an autonomous mandate (issuer credential plus the customer's mandate) and creates a pending Vorim mandate from its payment constraints. Limits Vorim cannot enforce are refused by name. Tested against chains produced by Mastercard's open reference implementation; not run against a live Mastercard system.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Sign-off packs also re-run when the agent's model or provider changes and every 30 days (`trigger`: `model_change`, `scheduled`).
|
|
15
|
+
|
|
16
|
+
## 4.5.0
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **Proven savings and timestamped case packs.** `recordActionOutcome({ decisionId, kind })` records what later happened (complaint, chargeback, confirmed fraud, reversed refund, no issue); `getSavingsReport()` gains `outcomes` (bad outcomes a shadow rule would have caught, ones no rule touched, refusals that drew complaints). `storeCasePack(caseRef)` keeps a pack stamped by an RFC 3161 TSA (DigiCert's public TSA by default), with `listStoredCasePacks` and `getStoredCasePack` (token plus the `openssl ts -verify` command).
|
|
21
|
+
- **Sign-off packs that keep themselves current.** Presets `refunds`, `collections`, `credit` and `aml` beside `hazards` and `fintech`; packs carry a PRA SS1/23 evidence mapping; the server re-runs an agent's latest pack when the rules change and raises `signoff.regressed` if the verdict got worse; `getSignoffDiff(id, againstId?)` lists what changed.
|
|
22
|
+
- **AP2 interop.** `exportMandateAp2(id)` returns the mandate as an Agent Payments Protocol v0.2 open Payment Mandate (SD-JWT, `vct: mandate.payment.open.1`, limits as `payment.amount_range`, `payment.budget`, `payment.agent_recurrence`, `payment.allowed_payees`); `importAp2Mandate({ sdJwt, issuerJwk, agentId, customerRef })` turns one into a pending Vorim mandate after checking the issuer signature and applying disclosures. Constraints Vorim cannot enforce are refused.
|
|
23
|
+
- **Hardware proof for mandate keys.** `getAttestationChallenge()`; `createMandate({ keyAttestation })` takes an Android Key Attestation chain or an Apple App Attest attestation, and `createMandate({ webauthn: { rpId, origin } })` makes a passkey mandate. `activateMandate` and `withdrawMandate` take a passkey assertion (`{ format: 'webauthn', ... }`) or an App Attest assertion (`{ format: 'app-attest', assertion }`) as well as a plain signature. The signed record says what was proven (`key_attestation`, `signature_assurance`: `passkey-synced` or `passkey-device-bound`, never conflated).
|
|
24
|
+
- **Case references.** `beforeAction()` and `declareIntent()` take `caseRef`, your case or customer reference (opaque: letters, digits, `. _ : @ -`, never a name). `getCasePack(caseRef)` returns a platform-signed case pack: every decision with its rule and signed approval lines, every intent and recorded outcome, and any customer mandate, in one timeline. `listCases({ days? })` lists the references seen.
|
|
25
|
+
- **Customer mandates.** `createMandate({ agentId, customerRef, alg: 'ES256' | 'EdDSA', publicKeyJwk, terms, expiresAt })` returns the `signing_input` the customer's device signs (ES256 for a phone's secure hardware: raw r||s or DER); `activateMandate(id, signature)` verifies it and returns the countersigned record. Pass `mandateId` on `beforeAction()`: an action outside the mandate's limits is refused with the term it broke, and an allowed or escalated amount is charged against it (given back if a person refuses it or it times out). Also `revokeMandate`, `getMandate`, `listMandates`, `getMandateEvidence`, and `withdrawMandate(id, signedAt, signature)` with the exported `mandateWithdrawalLine()` for a customer withdrawing with their own key.
|
|
26
|
+
- **Consumer Duty tags.** `declareIntent()` takes `product`, `vulnerableCustomer` and `vulnerabilityDrivers` (the FCA's FG21/1 four: `health`, `life_events`, `resilience`, `capability`), sent beside the signed bytes. `getConsumerDutyReport({ days? })` and `setOutcomeDefinition({ product, good, poor?, measure? })`.
|
|
27
|
+
- **Evidence.** `getSavingsReport({ days?, reviewMinutes?, hourlyCost?, currency?, agentId? })`, `runSignoff(agentId, { preset?: 'hazards' | 'fintech', scenarios?, label? })`, `listSignoffs`, `getSignoff`, `gatewayCheck({...})` for a bank's API edge, and `verifyEvidence(doc)` for any sealed Vorim document.
|
|
28
|
+
|
|
3
29
|
## 4.4.0
|
|
4
30
|
|
|
5
31
|
### Added
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from './index.cjs';
|
|
2
|
-
import { P as PermissionScope } from './types-
|
|
2
|
+
import { P as PermissionScope } from './types-3hhqtL0W.cjs';
|
|
3
3
|
import { E as EscalationPolicy } from './_runtime-gate-DOJUKJBu.cjs';
|
|
4
4
|
|
|
5
5
|
/** What a ceiling an operation is measured against. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from './index.js';
|
|
2
|
-
import { P as PermissionScope } from './types-
|
|
2
|
+
import { P as PermissionScope } from './types-3hhqtL0W.js';
|
|
3
3
|
import { E as EscalationPolicy } from './_runtime-gate-DOJUKJBu.js';
|
|
4
4
|
|
|
5
5
|
/** What a ceiling an operation is measured against. */
|
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
isDigest: () => isDigest,
|
|
57
57
|
isKeyedCommitment: () => isKeyedCommitment,
|
|
58
58
|
jcsCanonicalise: () => jcsCanonicalise,
|
|
59
|
+
mandateWithdrawalLine: () => mandateWithdrawalLine,
|
|
59
60
|
portableReceiptCanonicalBytes: () => portableReceiptCanonicalBytes,
|
|
60
61
|
prepareReplayContext: () => prepareReplayContext,
|
|
61
62
|
signHttpRequest: () => signHttpRequest,
|
|
@@ -940,7 +941,7 @@ function canonicalIntent(value) {
|
|
|
940
941
|
const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
|
|
941
942
|
return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalIntent(obj[k])}`).join(",")}}`;
|
|
942
943
|
}
|
|
943
|
-
var SDK_VERSION = true ? "4.
|
|
944
|
+
var SDK_VERSION = true ? "4.6.0" : "0.0.0";
|
|
944
945
|
var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
|
|
945
946
|
function sleep(ms) {
|
|
946
947
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -1562,7 +1563,9 @@ var VorimSDK = class _VorimSDK {
|
|
|
1562
1563
|
trace_id: input.traceId,
|
|
1563
1564
|
span_id: input.spanId,
|
|
1564
1565
|
traceparent: input.traceparent,
|
|
1565
|
-
intent_id: input.intentId
|
|
1566
|
+
intent_id: input.intentId,
|
|
1567
|
+
case_ref: input.caseRef,
|
|
1568
|
+
mandate_id: input.mandateId
|
|
1566
1569
|
};
|
|
1567
1570
|
let raw;
|
|
1568
1571
|
try {
|
|
@@ -2098,7 +2101,11 @@ var VorimSDK = class _VorimSDK {
|
|
|
2098
2101
|
workflow_id: input.workflowId,
|
|
2099
2102
|
...signed,
|
|
2100
2103
|
expected_outcome: input.expectedOutcome,
|
|
2101
|
-
review_at: input.reviewAt
|
|
2104
|
+
review_at: input.reviewAt,
|
|
2105
|
+
case_ref: input.caseRef,
|
|
2106
|
+
product: input.product,
|
|
2107
|
+
vulnerable_customer: input.vulnerableCustomer,
|
|
2108
|
+
vulnerability_drivers: input.vulnerabilityDrivers
|
|
2102
2109
|
});
|
|
2103
2110
|
}
|
|
2104
2111
|
/**
|
|
@@ -2122,6 +2129,245 @@ var VorimSDK = class _VorimSDK {
|
|
|
2122
2129
|
const s = q.toString();
|
|
2123
2130
|
return this.get(`/intents/ledger${s ? `?${s}` : ""}`);
|
|
2124
2131
|
}
|
|
2132
|
+
// ─── Customer mandates ──────────────────────────────────────────────────
|
|
2133
|
+
/**
|
|
2134
|
+
* Create a pending customer mandate. Returns `signing_input`: the exact text
|
|
2135
|
+
* the customer's device must sign (ES256 raw r||s or DER, base64url) before
|
|
2136
|
+
* `activateMandate`. The private key stays on the customer's device.
|
|
2137
|
+
*
|
|
2138
|
+
* @example
|
|
2139
|
+
* const { mandate, signing_input } = await vorim.createMandate({
|
|
2140
|
+
* agentId, customerRef: 'cust_7731', alg: 'ES256', publicKeyJwk: phoneJwk,
|
|
2141
|
+
* terms: { actionTypes: ['initiate_payment'], maxAmount: 5000, currency: 'GBP', maxTotal: 20000 },
|
|
2142
|
+
* expiresAt: new Date(Date.now() + 30 * 86400e3).toISOString(),
|
|
2143
|
+
* });
|
|
2144
|
+
* // ... the customer's app signs signing_input ...
|
|
2145
|
+
* await vorim.activateMandate(mandate.mandate_id, signatureFromPhone);
|
|
2146
|
+
* await vorim.beforeAction({ agentId, actionType: 'initiate_payment', payload: { amount: 4000, currency: 'GBP' }, mandateId: mandate.mandate_id });
|
|
2147
|
+
*/
|
|
2148
|
+
async createMandate(input) {
|
|
2149
|
+
const t = input.terms;
|
|
2150
|
+
return this.post("/mandates", {
|
|
2151
|
+
agent_id: input.agentId,
|
|
2152
|
+
customer_ref: input.customerRef,
|
|
2153
|
+
alg: input.alg,
|
|
2154
|
+
public_key_jwk: input.publicKeyJwk,
|
|
2155
|
+
terms: {
|
|
2156
|
+
action_types: t.actionTypes,
|
|
2157
|
+
targets: t.targets,
|
|
2158
|
+
max_amount: t.maxAmount,
|
|
2159
|
+
currency: t.currency,
|
|
2160
|
+
max_total: t.maxTotal,
|
|
2161
|
+
max_uses: t.maxUses,
|
|
2162
|
+
read_only: t.readOnly,
|
|
2163
|
+
amount_field: t.amountField
|
|
2164
|
+
},
|
|
2165
|
+
expires_at: input.expiresAt,
|
|
2166
|
+
key_attestation: !input.keyAttestation ? void 0 : input.keyAttestation.format === "android-key" ? { format: "android-key", certificate_chain: input.keyAttestation.certificateChain, challenge: input.keyAttestation.challenge } : {
|
|
2167
|
+
format: "apple-app-attest",
|
|
2168
|
+
attestation_object: input.keyAttestation.attestationObject,
|
|
2169
|
+
key_id: input.keyAttestation.keyId,
|
|
2170
|
+
app_id: input.keyAttestation.appId,
|
|
2171
|
+
environment: input.keyAttestation.environment,
|
|
2172
|
+
challenge: input.keyAttestation.challenge
|
|
2173
|
+
},
|
|
2174
|
+
webauthn: input.webauthn ? { rp_id: input.webauthn.rpId, origin: input.webauthn.origin } : void 0
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* The mandate as an AP2 (Agent Payments Protocol v0.2) open Payment Mandate:
|
|
2179
|
+
* an SD-JWT signed by Vorim, `vct: "mandate.payment.open.1"`, with the
|
|
2180
|
+
* limits as AP2 constraints. `not_expressed_in_ap2` lists anything AP2
|
|
2181
|
+
* cannot carry.
|
|
2182
|
+
*/
|
|
2183
|
+
async exportMandateAp2(mandateId) {
|
|
2184
|
+
return this.get(`/mandates/${encodeURIComponent(mandateId)}/ap2`);
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Import an AP2 open Payment Mandate (SD-JWT, disclosures applied) as a
|
|
2188
|
+
* pending Vorim mandate. The issuer signature must verify against
|
|
2189
|
+
* `issuerJwk`; constraints Vorim cannot enforce are refused. The
|
|
2190
|
+
* customer's key (`cnf.jwk`) still signs `signing_input` to activate it.
|
|
2191
|
+
*/
|
|
2192
|
+
async importAp2Mandate(input) {
|
|
2193
|
+
return this.post("/mandates/import-ap2", { sd_jwt: input.sdJwt, issuer_jwk: input.issuerJwk, agent_id: input.agentId, customer_ref: input.customerRef, action_types: input.actionTypes });
|
|
2194
|
+
}
|
|
2195
|
+
/** A one-time challenge (10 minutes) for a hardware key attestation on `createMandate`. */
|
|
2196
|
+
async getAttestationChallenge() {
|
|
2197
|
+
return this.post("/mandates/attestation-challenge", {});
|
|
2198
|
+
}
|
|
2199
|
+
/** Activate a mandate with the customer's signature over its `signing_input`. Returns the countersigned record. */
|
|
2200
|
+
async activateMandate(mandateId, signature) {
|
|
2201
|
+
return this.post(`/mandates/${encodeURIComponent(mandateId)}/activate`, { signature });
|
|
2202
|
+
}
|
|
2203
|
+
/** The firm revokes a mandate; every later action under it is refused. */
|
|
2204
|
+
async revokeMandate(mandateId, reason) {
|
|
2205
|
+
return this.post(`/mandates/${encodeURIComponent(mandateId)}/revoke`, { reason });
|
|
2206
|
+
}
|
|
2207
|
+
async getMandate(mandateId) {
|
|
2208
|
+
return this.get(`/mandates/${encodeURIComponent(mandateId)}`);
|
|
2209
|
+
}
|
|
2210
|
+
async listMandates(params = {}) {
|
|
2211
|
+
const q = new URLSearchParams();
|
|
2212
|
+
if (params.agentId) q.set("agent_id", params.agentId);
|
|
2213
|
+
if (params.customerRef) q.set("customer_ref", params.customerRef);
|
|
2214
|
+
if (params.limit) q.set("limit", String(params.limit));
|
|
2215
|
+
const s = q.toString();
|
|
2216
|
+
return this.get(`/mandates${s ? `?${s}` : ""}`);
|
|
2217
|
+
}
|
|
2218
|
+
/** The countersigned record, every decision taken under the mandate, and a verification result. */
|
|
2219
|
+
async getMandateEvidence(mandateId) {
|
|
2220
|
+
return this.get(`/mandates/${encodeURIComponent(mandateId)}/evidence`);
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* The customer withdraws a mandate with their own key; no Vorim account
|
|
2224
|
+
* is involved. Sign `mandateWithdrawalLine(mandateId, signedAt)` on the
|
|
2225
|
+
* device (signedAt within 5 minutes of now) and pass the signature here.
|
|
2226
|
+
*/
|
|
2227
|
+
async withdrawMandate(mandateId, signedAt, signature) {
|
|
2228
|
+
return this.post(`/mandates/${encodeURIComponent(mandateId)}/withdraw`, { signed_at: signedAt, signature });
|
|
2229
|
+
}
|
|
2230
|
+
// ─── Evidence ───────────────────────────────────────────────────────────
|
|
2231
|
+
/** Case references seen in the last `days` (default 90). */
|
|
2232
|
+
async listCases(params = {}) {
|
|
2233
|
+
return this.get(`/evidence/cases${params.days ? `?days=${encodeURIComponent(String(params.days))}` : ""}`);
|
|
2234
|
+
}
|
|
2235
|
+
/** A platform-signed case pack for one case reference: decisions, approvals, intents, outcomes, mandates. */
|
|
2236
|
+
async getCasePack(caseRef) {
|
|
2237
|
+
return this.get(`/evidence/cases/${encodeURIComponent(caseRef)}/pack`);
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Keep a case pack, stamped by an RFC 3161 Time Stamping Authority unless
|
|
2241
|
+
* `timestamp: false`. If the TSA cannot be reached the pack is still kept
|
|
2242
|
+
* and `timestamp.ok` is false with the error.
|
|
2243
|
+
*/
|
|
2244
|
+
async storeCasePack(caseRef, input = {}) {
|
|
2245
|
+
return this.post(`/evidence/cases/${encodeURIComponent(caseRef)}/packs`, input);
|
|
2246
|
+
}
|
|
2247
|
+
async listStoredCasePacks(caseRef) {
|
|
2248
|
+
return this.get(`/evidence/cases/${encodeURIComponent(caseRef)}/packs`);
|
|
2249
|
+
}
|
|
2250
|
+
/** A kept case pack with its timestamp token and the openssl command to verify it. */
|
|
2251
|
+
async getStoredCasePack(id) {
|
|
2252
|
+
return this.get(`/evidence/case-pack/${encodeURIComponent(id)}`);
|
|
2253
|
+
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Record what later happened to an action: `complaint`, `chargeback`,
|
|
2256
|
+
* `fraud_confirmed`, `refund_reversed` or `no_issue`. The savings report
|
|
2257
|
+
* uses these to show which bad outcomes a shadow rule would have caught.
|
|
2258
|
+
*/
|
|
2259
|
+
async recordActionOutcome(input) {
|
|
2260
|
+
return this.post("/evidence/outcomes", { decision_id: input.decisionId, kind: input.kind, amount: input.amount, currency: input.currency, occurred_at: input.occurredAt, note: input.note });
|
|
2261
|
+
}
|
|
2262
|
+
/** What rules did and shadow rules would have done, costed at your own review assumptions. */
|
|
2263
|
+
async getSavingsReport(params = {}) {
|
|
2264
|
+
const q = new URLSearchParams();
|
|
2265
|
+
if (params.days) q.set("days", String(params.days));
|
|
2266
|
+
if (params.reviewMinutes) q.set("review_minutes", String(params.reviewMinutes));
|
|
2267
|
+
if (params.hourlyCost !== void 0) q.set("hourly_cost", String(params.hourlyCost));
|
|
2268
|
+
if (params.currency) q.set("currency", params.currency);
|
|
2269
|
+
if (params.agentId) q.set("agent_id", params.agentId);
|
|
2270
|
+
return this.get(`/evidence/savings?${q.toString()}`);
|
|
2271
|
+
}
|
|
2272
|
+
/** Consumer Duty outcomes by product, vulnerability and FG21/1 driver. */
|
|
2273
|
+
async getConsumerDutyReport(params = {}) {
|
|
2274
|
+
return this.get(`/evidence/consumer-duty${params.days ? `?days=${encodeURIComponent(String(params.days))}` : ""}`);
|
|
2275
|
+
}
|
|
2276
|
+
/** Record what a good (and poor) outcome looks like for a product. */
|
|
2277
|
+
async setOutcomeDefinition(input) {
|
|
2278
|
+
return this.put("/evidence/outcome-definitions", input);
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* Run a sign-off pack for one agent: scenarios through the real gate in
|
|
2282
|
+
* shadow, answers to the risk committee's questions, signed and stored.
|
|
2283
|
+
*/
|
|
2284
|
+
async runSignoff(agentId, input = {}) {
|
|
2285
|
+
return this.post(`/evidence/signoffs/${encodeURIComponent(agentId)}`, input);
|
|
2286
|
+
}
|
|
2287
|
+
async listSignoffs(agentId) {
|
|
2288
|
+
return this.get(`/evidence/signoffs/${encodeURIComponent(agentId)}`);
|
|
2289
|
+
}
|
|
2290
|
+
async getSignoff(id) {
|
|
2291
|
+
return this.get(`/evidence/signoff/${encodeURIComponent(id)}`);
|
|
2292
|
+
}
|
|
2293
|
+
/** What changed between a sign-off pack and the one before it (or `againstId`): verdict, settings, scenarios, answers, permissions. */
|
|
2294
|
+
async getSignoffDiff(id, againstId) {
|
|
2295
|
+
return this.get(`/evidence/signoff/${encodeURIComponent(id)}/diff${againstId ? `?against=${encodeURIComponent(againstId)}` : ""}`);
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* For a bank's API edge: is this request signed by the agent, is the agent
|
|
2299
|
+
* still allowed to act, and is it inside a mandate for this customer?
|
|
2300
|
+
* Returns a platform-sealed verdict to keep.
|
|
2301
|
+
*/
|
|
2302
|
+
async gatewayCheck(input) {
|
|
2303
|
+
return this.post("/gateway/check", {
|
|
2304
|
+
request: input.request,
|
|
2305
|
+
mandate_id: input.mandateId,
|
|
2306
|
+
customer_ref: input.customerRef,
|
|
2307
|
+
action_type: input.actionType,
|
|
2308
|
+
amount: input.amount,
|
|
2309
|
+
currency: input.currency,
|
|
2310
|
+
max_age_seconds: input.maxAgeSeconds
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* AI incidents and near misses (4.6): kill-switch stops, tripwires that
|
|
2315
|
+
* refused, and sign-off packs that got worse, each with Vorim's suggested
|
|
2316
|
+
* classification and the firm's own assessment where recorded.
|
|
2317
|
+
*/
|
|
2318
|
+
async listIncidents(params = {}) {
|
|
2319
|
+
return this.get(`/evidence/incidents${params.days ? `?days=${encodeURIComponent(String(params.days))}` : ""}`);
|
|
2320
|
+
}
|
|
2321
|
+
/** One signed incident record, laid out as the FCA's PS26/2 standard template (`payload.ps26_2`). */
|
|
2322
|
+
async getIncident(ref) {
|
|
2323
|
+
return this.get(`/evidence/incidents/${encodeURIComponent(ref)}`);
|
|
2324
|
+
}
|
|
2325
|
+
/**
|
|
2326
|
+
* Record the firm's assessment of an incident. `causeType` must be one of
|
|
2327
|
+
* the PS26/2 template's cause types; closing it stamps the resolution time.
|
|
2328
|
+
* Whether it is reportable is the firm's decision.
|
|
2329
|
+
*/
|
|
2330
|
+
async updateIncident(ref, input) {
|
|
2331
|
+
const map = { incidentType: "incident_type", actionsPlanned: "actions_planned", actionsTaken: "actions_taken", resolvedAt: "resolved_at", causeType: "cause_type", thirdPartyName: "third_party_name" };
|
|
2332
|
+
const body = {};
|
|
2333
|
+
for (const [k, v] of Object.entries(input)) if (v !== void 0) body[map[k] ?? k] = v;
|
|
2334
|
+
return this.patch(`/evidence/incidents/${encodeURIComponent(ref)}`, body);
|
|
2335
|
+
}
|
|
2336
|
+
/** A signed statement of delegated authority for one agent: identity, authority, accountability, execution, and the gaps a reviewer will ask about. */
|
|
2337
|
+
async getAuthorityStatement(agentId) {
|
|
2338
|
+
return this.get(`/evidence/authority/${encodeURIComponent(agentId)}`);
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Import a Mastercard Verifiable Intent autonomous mandate (L1 issuer
|
|
2342
|
+
* credential + L2 customer mandate, payment side) as a pending Vorim
|
|
2343
|
+
* mandate. The customer key in L1 still signs `signing_input` to activate it.
|
|
2344
|
+
* Limits Vorim cannot enforce are refused by name (422).
|
|
2345
|
+
*/
|
|
2346
|
+
async importVerifiableIntent(input) {
|
|
2347
|
+
return this.post("/mandates/import-verifiable-intent", {
|
|
2348
|
+
l1: input.l1,
|
|
2349
|
+
l2: input.l2,
|
|
2350
|
+
issuer_jwk: input.issuerJwk,
|
|
2351
|
+
agent_id: input.agentId,
|
|
2352
|
+
customer_ref: input.customerRef,
|
|
2353
|
+
action_types: input.actionTypes,
|
|
2354
|
+
expected_aud: input.expectedAud
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Verify a Visa Trusted Agent Protocol message signature on a request your
|
|
2359
|
+
* site received: the signature over "@authority" and "@path", the 8-minute
|
|
2360
|
+
* window, the tag (`agent-browser-auth` or `agent-payer-auth`) and a nonce
|
|
2361
|
+
* used once. Keys come from the key directory configured on the server, or
|
|
2362
|
+
* pass `keys`. Needs an API key with runtime:decide.
|
|
2363
|
+
*/
|
|
2364
|
+
async verifyTap(input) {
|
|
2365
|
+
return this.post("/gateway/tap/verify", { url: input.url, headers: input.headers, keys: input.keys, require_tag: input.requireTag });
|
|
2366
|
+
}
|
|
2367
|
+
/** Check any sealed Vorim document (case pack, sign-off, gateway verdict, mandate record). Public endpoint. */
|
|
2368
|
+
async verifyEvidence(doc) {
|
|
2369
|
+
return this.post("/evidence/verify", { payload: doc.payload, hash: doc.hash, signature: doc.signature });
|
|
2370
|
+
}
|
|
2125
2371
|
/** Close an intent when the job ends. Further actions under it are off intent. */
|
|
2126
2372
|
async completeIntent(intentId, status = "completed", outcome) {
|
|
2127
2373
|
return this.post(`/intents/${encodeURIComponent(intentId)}/complete`, { status, outcome });
|
|
@@ -2536,6 +2782,9 @@ async function deviceLogin(opts) {
|
|
|
2536
2782
|
wait = intervalMs;
|
|
2537
2783
|
}
|
|
2538
2784
|
}
|
|
2785
|
+
function mandateWithdrawalLine(mandateId, signedAt) {
|
|
2786
|
+
return `vorim-mandate-withdraw|v1|${mandateId}|${signedAt}`;
|
|
2787
|
+
}
|
|
2539
2788
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2540
2789
|
0 && (module.exports = {
|
|
2541
2790
|
CANONICAL_TOOL_CATALOGUE_VERSION,
|
|
@@ -2563,6 +2812,7 @@ async function deviceLogin(opts) {
|
|
|
2563
2812
|
isDigest,
|
|
2564
2813
|
isKeyedCommitment,
|
|
2565
2814
|
jcsCanonicalise,
|
|
2815
|
+
mandateWithdrawalLine,
|
|
2566
2816
|
portableReceiptCanonicalBytes,
|
|
2567
2817
|
prepareReplayContext,
|
|
2568
2818
|
signHttpRequest,
|