@vorim/sdk 4.3.0 → 4.5.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 +23 -0
- package/dist/{_commerce-core-BQbISpWe.d.cts → _commerce-core-QF7IKCKQ.d.cts} +1 -1
- package/dist/{_commerce-core-BIqTJ7Om.d.ts → _commerce-core-jih7k4hQ.d.ts} +1 -1
- package/dist/index.cjs +218 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +162 -3
- package/dist/index.d.ts +162 -3
- package/dist/index.js +217 -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-DwPEBj7p.d.cts → types-3hhqtL0W.d.cts} +110 -2
- package/dist/{types-DwPEBj7p.d.ts → types-3hhqtL0W.d.ts} +110 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog — @vorim/sdk
|
|
2
2
|
|
|
3
|
+
## 4.5.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **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).
|
|
8
|
+
- **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.
|
|
9
|
+
- **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.
|
|
10
|
+
- **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).
|
|
11
|
+
- **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.
|
|
12
|
+
- **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.
|
|
13
|
+
- **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? })`.
|
|
14
|
+
- **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.
|
|
15
|
+
|
|
16
|
+
## 4.4.0
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **Outcome reviews on intents.** `declareIntent()` takes `expectedOutcome` (what should be true if the work succeeded, up to 500 characters) and `reviewAt` (when to check, up to a year ahead). `recordIntentOutcome(intentId, 'met' | 'partly_met' | 'not_met', note?)` records the result once (a second call is refused with 409 `OUTCOME_RECORDED`); `getIntentOutcomes({ days? })` returns the summary and the reviews that are due. The outcome fields travel beside the agent's signature, not inside it, so signed declarations verify exactly as before.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- `maxAmount` is documented for what it is: a whole number compared as it is with the payload's amount, with no unit or currency conversion. Use the unit the agent sends; the platform convention is minor units (pence, cents), so £750 is `75000`. On the server, an amount that is present but cannot be read (for example `'£20k'`) now counts as over the intent's cap, the same way `payload_amount_gte` rules already sent it to review.
|
|
25
|
+
|
|
3
26
|
## 4.3.0
|
|
4
27
|
|
|
5
28
|
### 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.5.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 {
|
|
@@ -2093,7 +2096,30 @@ var VorimSDK = class _VorimSDK {
|
|
|
2093
2096
|
const signature = await this.sign(canonicalIntent({ type: "vorim-agent-intent", v: 1, ...fields, signed_at }), key);
|
|
2094
2097
|
signed = { signature, signed_at };
|
|
2095
2098
|
}
|
|
2096
|
-
return this.post("/intents", {
|
|
2099
|
+
return this.post("/intents", {
|
|
2100
|
+
...fields,
|
|
2101
|
+
workflow_id: input.workflowId,
|
|
2102
|
+
...signed,
|
|
2103
|
+
expected_outcome: input.expectedOutcome,
|
|
2104
|
+
review_at: input.reviewAt,
|
|
2105
|
+
case_ref: input.caseRef,
|
|
2106
|
+
product: input.product,
|
|
2107
|
+
vulnerable_customer: input.vulnerableCustomer,
|
|
2108
|
+
vulnerability_drivers: input.vulnerabilityDrivers
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Record whether an intent achieved what it set out to do. Once only: a
|
|
2113
|
+
* second call is refused with 409 OUTCOME_RECORDED. With an API key it is
|
|
2114
|
+
* recorded as the agent's own assessment; a person reviewing in the
|
|
2115
|
+
* dashboard is recorded as the operator.
|
|
2116
|
+
*/
|
|
2117
|
+
async recordIntentOutcome(intentId, result, note) {
|
|
2118
|
+
return this.post(`/intents/${encodeURIComponent(intentId)}/outcome`, { result, note });
|
|
2119
|
+
}
|
|
2120
|
+
/** Outcome summary for the last `days` (default 30) plus the reviews that are due. */
|
|
2121
|
+
async getIntentOutcomes(params = {}) {
|
|
2122
|
+
return this.get(`/intents/outcomes${params.days ? `?days=${encodeURIComponent(String(params.days))}` : ""}`);
|
|
2097
2123
|
}
|
|
2098
2124
|
/** A platform-signed ledger of intents over a period, for a counterparty to verify offline. */
|
|
2099
2125
|
async getIntentLedger(params = {}) {
|
|
@@ -2103,6 +2129,191 @@ var VorimSDK = class _VorimSDK {
|
|
|
2103
2129
|
const s = q.toString();
|
|
2104
2130
|
return this.get(`/intents/ledger${s ? `?${s}` : ""}`);
|
|
2105
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
|
+
/** Check any sealed Vorim document (case pack, sign-off, gateway verdict, mandate record). Public endpoint. */
|
|
2314
|
+
async verifyEvidence(doc) {
|
|
2315
|
+
return this.post("/evidence/verify", { payload: doc.payload, hash: doc.hash, signature: doc.signature });
|
|
2316
|
+
}
|
|
2106
2317
|
/** Close an intent when the job ends. Further actions under it are off intent. */
|
|
2107
2318
|
async completeIntent(intentId, status = "completed", outcome) {
|
|
2108
2319
|
return this.post(`/intents/${encodeURIComponent(intentId)}/complete`, { status, outcome });
|
|
@@ -2517,6 +2728,9 @@ async function deviceLogin(opts) {
|
|
|
2517
2728
|
wait = intervalMs;
|
|
2518
2729
|
}
|
|
2519
2730
|
}
|
|
2731
|
+
function mandateWithdrawalLine(mandateId, signedAt) {
|
|
2732
|
+
return `vorim-mandate-withdraw|v1|${mandateId}|${signedAt}`;
|
|
2733
|
+
}
|
|
2520
2734
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2521
2735
|
0 && (module.exports = {
|
|
2522
2736
|
CANONICAL_TOOL_CATALOGUE_VERSION,
|
|
@@ -2544,6 +2758,7 @@ async function deviceLogin(opts) {
|
|
|
2544
2758
|
isDigest,
|
|
2545
2759
|
isKeyedCommitment,
|
|
2546
2760
|
jcsCanonicalise,
|
|
2761
|
+
mandateWithdrawalLine,
|
|
2547
2762
|
portableReceiptCanonicalBytes,
|
|
2548
2763
|
prepareReplayContext,
|
|
2549
2764
|
signHttpRequest,
|