@vorim/sdk 4.4.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 +13 -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 +199 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -3
- package/dist/index.d.ts +151 -3
- package/dist/index.js +198 -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/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView, m as DeclareIntentInput, I as Intent } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView, m as DeclareIntentInput, I as Intent, n as CreateMandateInput, o as CustomerSignature, G as GatewayCheckInput } from './types-3hhqtL0W.cjs';
|
|
2
|
+
export { p as AgentStatus, q as ApprovalAttestation, r as AuditEventType, s as AuditResult, t as BudgetEnforcement, u as BudgetScope, v as DecisionVerdict, M as MandateTerms, w as WorkflowGraphEdge, x as WorkflowGraphEvent, y as WorkflowGraphNode } from './types-3hhqtL0W.cjs';
|
|
3
3
|
import { PortableSignedReceipt } from '@vorim/shared-types';
|
|
4
4
|
export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
|
|
5
5
|
import { HttpRequestLike, SignHttpRequestOptions, SignHttpRequestResult } from './httpSignatures.cjs';
|
|
@@ -1084,6 +1084,151 @@ declare class VorimSDK {
|
|
|
1084
1084
|
agentId?: string;
|
|
1085
1085
|
days?: number;
|
|
1086
1086
|
}): Promise<any>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Create a pending customer mandate. Returns `signing_input`: the exact text
|
|
1089
|
+
* the customer's device must sign (ES256 raw r||s or DER, base64url) before
|
|
1090
|
+
* `activateMandate`. The private key stays on the customer's device.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* const { mandate, signing_input } = await vorim.createMandate({
|
|
1094
|
+
* agentId, customerRef: 'cust_7731', alg: 'ES256', publicKeyJwk: phoneJwk,
|
|
1095
|
+
* terms: { actionTypes: ['initiate_payment'], maxAmount: 5000, currency: 'GBP', maxTotal: 20000 },
|
|
1096
|
+
* expiresAt: new Date(Date.now() + 30 * 86400e3).toISOString(),
|
|
1097
|
+
* });
|
|
1098
|
+
* // ... the customer's app signs signing_input ...
|
|
1099
|
+
* await vorim.activateMandate(mandate.mandate_id, signatureFromPhone);
|
|
1100
|
+
* await vorim.beforeAction({ agentId, actionType: 'initiate_payment', payload: { amount: 4000, currency: 'GBP' }, mandateId: mandate.mandate_id });
|
|
1101
|
+
*/
|
|
1102
|
+
createMandate(input: CreateMandateInput): Promise<{
|
|
1103
|
+
mandate: any;
|
|
1104
|
+
signing_input: string;
|
|
1105
|
+
}>;
|
|
1106
|
+
/**
|
|
1107
|
+
* The mandate as an AP2 (Agent Payments Protocol v0.2) open Payment Mandate:
|
|
1108
|
+
* an SD-JWT signed by Vorim, `vct: "mandate.payment.open.1"`, with the
|
|
1109
|
+
* limits as AP2 constraints. `not_expressed_in_ap2` lists anything AP2
|
|
1110
|
+
* cannot carry.
|
|
1111
|
+
*/
|
|
1112
|
+
exportMandateAp2(mandateId: string): Promise<{
|
|
1113
|
+
sd_jwt: string;
|
|
1114
|
+
payload: any;
|
|
1115
|
+
not_expressed_in_ap2: string[];
|
|
1116
|
+
verify_with: any;
|
|
1117
|
+
}>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Import an AP2 open Payment Mandate (SD-JWT, disclosures applied) as a
|
|
1120
|
+
* pending Vorim mandate. The issuer signature must verify against
|
|
1121
|
+
* `issuerJwk`; constraints Vorim cannot enforce are refused. The
|
|
1122
|
+
* customer's key (`cnf.jwk`) still signs `signing_input` to activate it.
|
|
1123
|
+
*/
|
|
1124
|
+
importAp2Mandate(input: {
|
|
1125
|
+
sdJwt: string;
|
|
1126
|
+
issuerJwk: Record<string, unknown>;
|
|
1127
|
+
agentId: string;
|
|
1128
|
+
customerRef: string;
|
|
1129
|
+
actionTypes?: string[];
|
|
1130
|
+
}): Promise<any>;
|
|
1131
|
+
/** A one-time challenge (10 minutes) for a hardware key attestation on `createMandate`. */
|
|
1132
|
+
getAttestationChallenge(): Promise<{
|
|
1133
|
+
challenge: string;
|
|
1134
|
+
expires_at: string;
|
|
1135
|
+
}>;
|
|
1136
|
+
/** Activate a mandate with the customer's signature over its `signing_input`. Returns the countersigned record. */
|
|
1137
|
+
activateMandate(mandateId: string, signature: CustomerSignature): Promise<any>;
|
|
1138
|
+
/** The firm revokes a mandate; every later action under it is refused. */
|
|
1139
|
+
revokeMandate(mandateId: string, reason?: string): Promise<any>;
|
|
1140
|
+
getMandate(mandateId: string): Promise<any>;
|
|
1141
|
+
listMandates(params?: {
|
|
1142
|
+
agentId?: string;
|
|
1143
|
+
customerRef?: string;
|
|
1144
|
+
limit?: number;
|
|
1145
|
+
}): Promise<any[]>;
|
|
1146
|
+
/** The countersigned record, every decision taken under the mandate, and a verification result. */
|
|
1147
|
+
getMandateEvidence(mandateId: string): Promise<any>;
|
|
1148
|
+
/**
|
|
1149
|
+
* The customer withdraws a mandate with their own key; no Vorim account
|
|
1150
|
+
* is involved. Sign `mandateWithdrawalLine(mandateId, signedAt)` on the
|
|
1151
|
+
* device (signedAt within 5 minutes of now) and pass the signature here.
|
|
1152
|
+
*/
|
|
1153
|
+
withdrawMandate(mandateId: string, signedAt: string, signature: CustomerSignature): Promise<any>;
|
|
1154
|
+
/** Case references seen in the last `days` (default 90). */
|
|
1155
|
+
listCases(params?: {
|
|
1156
|
+
days?: number;
|
|
1157
|
+
}): Promise<any[]>;
|
|
1158
|
+
/** A platform-signed case pack for one case reference: decisions, approvals, intents, outcomes, mandates. */
|
|
1159
|
+
getCasePack(caseRef: string): Promise<any>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Keep a case pack, stamped by an RFC 3161 Time Stamping Authority unless
|
|
1162
|
+
* `timestamp: false`. If the TSA cannot be reached the pack is still kept
|
|
1163
|
+
* and `timestamp.ok` is false with the error.
|
|
1164
|
+
*/
|
|
1165
|
+
storeCasePack(caseRef: string, input?: {
|
|
1166
|
+
timestamp?: boolean;
|
|
1167
|
+
}): Promise<any>;
|
|
1168
|
+
listStoredCasePacks(caseRef: string): Promise<any[]>;
|
|
1169
|
+
/** A kept case pack with its timestamp token and the openssl command to verify it. */
|
|
1170
|
+
getStoredCasePack(id: string): Promise<any>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Record what later happened to an action: `complaint`, `chargeback`,
|
|
1173
|
+
* `fraud_confirmed`, `refund_reversed` or `no_issue`. The savings report
|
|
1174
|
+
* uses these to show which bad outcomes a shadow rule would have caught.
|
|
1175
|
+
*/
|
|
1176
|
+
recordActionOutcome(input: {
|
|
1177
|
+
decisionId: string;
|
|
1178
|
+
kind: 'complaint' | 'chargeback' | 'fraud_confirmed' | 'refund_reversed' | 'no_issue';
|
|
1179
|
+
amount?: number;
|
|
1180
|
+
currency?: string;
|
|
1181
|
+
occurredAt?: string;
|
|
1182
|
+
note?: string;
|
|
1183
|
+
}): Promise<any>;
|
|
1184
|
+
/** What rules did and shadow rules would have done, costed at your own review assumptions. */
|
|
1185
|
+
getSavingsReport(params?: {
|
|
1186
|
+
days?: number;
|
|
1187
|
+
reviewMinutes?: number;
|
|
1188
|
+
hourlyCost?: number;
|
|
1189
|
+
currency?: string;
|
|
1190
|
+
agentId?: string;
|
|
1191
|
+
}): Promise<any>;
|
|
1192
|
+
/** Consumer Duty outcomes by product, vulnerability and FG21/1 driver. */
|
|
1193
|
+
getConsumerDutyReport(params?: {
|
|
1194
|
+
days?: number;
|
|
1195
|
+
}): Promise<any>;
|
|
1196
|
+
/** Record what a good (and poor) outcome looks like for a product. */
|
|
1197
|
+
setOutcomeDefinition(input: {
|
|
1198
|
+
product: string;
|
|
1199
|
+
good: string;
|
|
1200
|
+
poor?: string;
|
|
1201
|
+
measure?: string;
|
|
1202
|
+
}): Promise<any>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Run a sign-off pack for one agent: scenarios through the real gate in
|
|
1205
|
+
* shadow, answers to the risk committee's questions, signed and stored.
|
|
1206
|
+
*/
|
|
1207
|
+
runSignoff(agentId: string, input?: {
|
|
1208
|
+
preset?: 'hazards' | 'fintech' | 'refunds' | 'collections' | 'credit' | 'aml';
|
|
1209
|
+
scenarios?: any[];
|
|
1210
|
+
label?: string;
|
|
1211
|
+
}): Promise<any>;
|
|
1212
|
+
listSignoffs(agentId: string): Promise<any[]>;
|
|
1213
|
+
getSignoff(id: string): Promise<any>;
|
|
1214
|
+
/** What changed between a sign-off pack and the one before it (or `againstId`): verdict, settings, scenarios, answers, permissions. */
|
|
1215
|
+
getSignoffDiff(id: string, againstId?: string): Promise<any>;
|
|
1216
|
+
/**
|
|
1217
|
+
* For a bank's API edge: is this request signed by the agent, is the agent
|
|
1218
|
+
* still allowed to act, and is it inside a mandate for this customer?
|
|
1219
|
+
* Returns a platform-sealed verdict to keep.
|
|
1220
|
+
*/
|
|
1221
|
+
gatewayCheck(input: GatewayCheckInput): Promise<any>;
|
|
1222
|
+
/** Check any sealed Vorim document (case pack, sign-off, gateway verdict, mandate record). Public endpoint. */
|
|
1223
|
+
verifyEvidence(doc: {
|
|
1224
|
+
payload: unknown;
|
|
1225
|
+
hash: string;
|
|
1226
|
+
signature: string;
|
|
1227
|
+
}): Promise<{
|
|
1228
|
+
type: string;
|
|
1229
|
+
ok: boolean;
|
|
1230
|
+
reason: string | null;
|
|
1231
|
+
}>;
|
|
1087
1232
|
/** Close an intent when the job ends. Further actions under it are off intent. */
|
|
1088
1233
|
completeIntent(intentId: string, status?: 'completed' | 'abandoned', outcome?: string): Promise<any>;
|
|
1089
1234
|
/** Intents for the org, newest first; filter by agent or status. */
|
|
@@ -1351,4 +1496,7 @@ interface DeviceLoginResult {
|
|
|
1351
1496
|
*/
|
|
1352
1497
|
declare function deviceLogin(opts: DeviceLoginOptions): Promise<DeviceLoginResult>;
|
|
1353
1498
|
|
|
1354
|
-
|
|
1499
|
+
/** The exact line a customer signs to withdraw a mandate (signedAt: ISO, within 5 minutes of sending). */
|
|
1500
|
+
declare function mandateWithdrawalLine(mandateId: string, signedAt: string): string;
|
|
1501
|
+
|
|
1502
|
+
export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, CreateMandateInput, CustomerSignature, DeclareIntentInput, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, GatewayCheckInput, HMAC_SHA256_PREFIX, HttpRequestLike, type HttpSignatureVerification, Intent, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, SignHttpRequestOptions, SignHttpRequestResult, SuspendPreview, SwarmView, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalIntent, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, foldTraceparent, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, mandateWithdrawalLine, prepareReplayContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView, m as DeclareIntentInput, I as Intent } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, S as SuspendPreview, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, e as SharedMemoryWriteInput, f as SharedMemoryEntry, g as SharedMemoryListResult, B as BeforeActionInput, h as TokenBudgetInput, i as TokenBudget, j as BudgetSpend, k as AuditEventInput, l as SwarmView, m as DeclareIntentInput, I as Intent, n as CreateMandateInput, o as CustomerSignature, G as GatewayCheckInput } from './types-3hhqtL0W.js';
|
|
2
|
+
export { p as AgentStatus, q as ApprovalAttestation, r as AuditEventType, s as AuditResult, t as BudgetEnforcement, u as BudgetScope, v as DecisionVerdict, M as MandateTerms, w as WorkflowGraphEdge, x as WorkflowGraphEvent, y as WorkflowGraphNode } from './types-3hhqtL0W.js';
|
|
3
3
|
import { PortableSignedReceipt } from '@vorim/shared-types';
|
|
4
4
|
export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
|
|
5
5
|
import { HttpRequestLike, SignHttpRequestOptions, SignHttpRequestResult } from './httpSignatures.js';
|
|
@@ -1084,6 +1084,151 @@ declare class VorimSDK {
|
|
|
1084
1084
|
agentId?: string;
|
|
1085
1085
|
days?: number;
|
|
1086
1086
|
}): Promise<any>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Create a pending customer mandate. Returns `signing_input`: the exact text
|
|
1089
|
+
* the customer's device must sign (ES256 raw r||s or DER, base64url) before
|
|
1090
|
+
* `activateMandate`. The private key stays on the customer's device.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* const { mandate, signing_input } = await vorim.createMandate({
|
|
1094
|
+
* agentId, customerRef: 'cust_7731', alg: 'ES256', publicKeyJwk: phoneJwk,
|
|
1095
|
+
* terms: { actionTypes: ['initiate_payment'], maxAmount: 5000, currency: 'GBP', maxTotal: 20000 },
|
|
1096
|
+
* expiresAt: new Date(Date.now() + 30 * 86400e3).toISOString(),
|
|
1097
|
+
* });
|
|
1098
|
+
* // ... the customer's app signs signing_input ...
|
|
1099
|
+
* await vorim.activateMandate(mandate.mandate_id, signatureFromPhone);
|
|
1100
|
+
* await vorim.beforeAction({ agentId, actionType: 'initiate_payment', payload: { amount: 4000, currency: 'GBP' }, mandateId: mandate.mandate_id });
|
|
1101
|
+
*/
|
|
1102
|
+
createMandate(input: CreateMandateInput): Promise<{
|
|
1103
|
+
mandate: any;
|
|
1104
|
+
signing_input: string;
|
|
1105
|
+
}>;
|
|
1106
|
+
/**
|
|
1107
|
+
* The mandate as an AP2 (Agent Payments Protocol v0.2) open Payment Mandate:
|
|
1108
|
+
* an SD-JWT signed by Vorim, `vct: "mandate.payment.open.1"`, with the
|
|
1109
|
+
* limits as AP2 constraints. `not_expressed_in_ap2` lists anything AP2
|
|
1110
|
+
* cannot carry.
|
|
1111
|
+
*/
|
|
1112
|
+
exportMandateAp2(mandateId: string): Promise<{
|
|
1113
|
+
sd_jwt: string;
|
|
1114
|
+
payload: any;
|
|
1115
|
+
not_expressed_in_ap2: string[];
|
|
1116
|
+
verify_with: any;
|
|
1117
|
+
}>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Import an AP2 open Payment Mandate (SD-JWT, disclosures applied) as a
|
|
1120
|
+
* pending Vorim mandate. The issuer signature must verify against
|
|
1121
|
+
* `issuerJwk`; constraints Vorim cannot enforce are refused. The
|
|
1122
|
+
* customer's key (`cnf.jwk`) still signs `signing_input` to activate it.
|
|
1123
|
+
*/
|
|
1124
|
+
importAp2Mandate(input: {
|
|
1125
|
+
sdJwt: string;
|
|
1126
|
+
issuerJwk: Record<string, unknown>;
|
|
1127
|
+
agentId: string;
|
|
1128
|
+
customerRef: string;
|
|
1129
|
+
actionTypes?: string[];
|
|
1130
|
+
}): Promise<any>;
|
|
1131
|
+
/** A one-time challenge (10 minutes) for a hardware key attestation on `createMandate`. */
|
|
1132
|
+
getAttestationChallenge(): Promise<{
|
|
1133
|
+
challenge: string;
|
|
1134
|
+
expires_at: string;
|
|
1135
|
+
}>;
|
|
1136
|
+
/** Activate a mandate with the customer's signature over its `signing_input`. Returns the countersigned record. */
|
|
1137
|
+
activateMandate(mandateId: string, signature: CustomerSignature): Promise<any>;
|
|
1138
|
+
/** The firm revokes a mandate; every later action under it is refused. */
|
|
1139
|
+
revokeMandate(mandateId: string, reason?: string): Promise<any>;
|
|
1140
|
+
getMandate(mandateId: string): Promise<any>;
|
|
1141
|
+
listMandates(params?: {
|
|
1142
|
+
agentId?: string;
|
|
1143
|
+
customerRef?: string;
|
|
1144
|
+
limit?: number;
|
|
1145
|
+
}): Promise<any[]>;
|
|
1146
|
+
/** The countersigned record, every decision taken under the mandate, and a verification result. */
|
|
1147
|
+
getMandateEvidence(mandateId: string): Promise<any>;
|
|
1148
|
+
/**
|
|
1149
|
+
* The customer withdraws a mandate with their own key; no Vorim account
|
|
1150
|
+
* is involved. Sign `mandateWithdrawalLine(mandateId, signedAt)` on the
|
|
1151
|
+
* device (signedAt within 5 minutes of now) and pass the signature here.
|
|
1152
|
+
*/
|
|
1153
|
+
withdrawMandate(mandateId: string, signedAt: string, signature: CustomerSignature): Promise<any>;
|
|
1154
|
+
/** Case references seen in the last `days` (default 90). */
|
|
1155
|
+
listCases(params?: {
|
|
1156
|
+
days?: number;
|
|
1157
|
+
}): Promise<any[]>;
|
|
1158
|
+
/** A platform-signed case pack for one case reference: decisions, approvals, intents, outcomes, mandates. */
|
|
1159
|
+
getCasePack(caseRef: string): Promise<any>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Keep a case pack, stamped by an RFC 3161 Time Stamping Authority unless
|
|
1162
|
+
* `timestamp: false`. If the TSA cannot be reached the pack is still kept
|
|
1163
|
+
* and `timestamp.ok` is false with the error.
|
|
1164
|
+
*/
|
|
1165
|
+
storeCasePack(caseRef: string, input?: {
|
|
1166
|
+
timestamp?: boolean;
|
|
1167
|
+
}): Promise<any>;
|
|
1168
|
+
listStoredCasePacks(caseRef: string): Promise<any[]>;
|
|
1169
|
+
/** A kept case pack with its timestamp token and the openssl command to verify it. */
|
|
1170
|
+
getStoredCasePack(id: string): Promise<any>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Record what later happened to an action: `complaint`, `chargeback`,
|
|
1173
|
+
* `fraud_confirmed`, `refund_reversed` or `no_issue`. The savings report
|
|
1174
|
+
* uses these to show which bad outcomes a shadow rule would have caught.
|
|
1175
|
+
*/
|
|
1176
|
+
recordActionOutcome(input: {
|
|
1177
|
+
decisionId: string;
|
|
1178
|
+
kind: 'complaint' | 'chargeback' | 'fraud_confirmed' | 'refund_reversed' | 'no_issue';
|
|
1179
|
+
amount?: number;
|
|
1180
|
+
currency?: string;
|
|
1181
|
+
occurredAt?: string;
|
|
1182
|
+
note?: string;
|
|
1183
|
+
}): Promise<any>;
|
|
1184
|
+
/** What rules did and shadow rules would have done, costed at your own review assumptions. */
|
|
1185
|
+
getSavingsReport(params?: {
|
|
1186
|
+
days?: number;
|
|
1187
|
+
reviewMinutes?: number;
|
|
1188
|
+
hourlyCost?: number;
|
|
1189
|
+
currency?: string;
|
|
1190
|
+
agentId?: string;
|
|
1191
|
+
}): Promise<any>;
|
|
1192
|
+
/** Consumer Duty outcomes by product, vulnerability and FG21/1 driver. */
|
|
1193
|
+
getConsumerDutyReport(params?: {
|
|
1194
|
+
days?: number;
|
|
1195
|
+
}): Promise<any>;
|
|
1196
|
+
/** Record what a good (and poor) outcome looks like for a product. */
|
|
1197
|
+
setOutcomeDefinition(input: {
|
|
1198
|
+
product: string;
|
|
1199
|
+
good: string;
|
|
1200
|
+
poor?: string;
|
|
1201
|
+
measure?: string;
|
|
1202
|
+
}): Promise<any>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Run a sign-off pack for one agent: scenarios through the real gate in
|
|
1205
|
+
* shadow, answers to the risk committee's questions, signed and stored.
|
|
1206
|
+
*/
|
|
1207
|
+
runSignoff(agentId: string, input?: {
|
|
1208
|
+
preset?: 'hazards' | 'fintech' | 'refunds' | 'collections' | 'credit' | 'aml';
|
|
1209
|
+
scenarios?: any[];
|
|
1210
|
+
label?: string;
|
|
1211
|
+
}): Promise<any>;
|
|
1212
|
+
listSignoffs(agentId: string): Promise<any[]>;
|
|
1213
|
+
getSignoff(id: string): Promise<any>;
|
|
1214
|
+
/** What changed between a sign-off pack and the one before it (or `againstId`): verdict, settings, scenarios, answers, permissions. */
|
|
1215
|
+
getSignoffDiff(id: string, againstId?: string): Promise<any>;
|
|
1216
|
+
/**
|
|
1217
|
+
* For a bank's API edge: is this request signed by the agent, is the agent
|
|
1218
|
+
* still allowed to act, and is it inside a mandate for this customer?
|
|
1219
|
+
* Returns a platform-sealed verdict to keep.
|
|
1220
|
+
*/
|
|
1221
|
+
gatewayCheck(input: GatewayCheckInput): Promise<any>;
|
|
1222
|
+
/** Check any sealed Vorim document (case pack, sign-off, gateway verdict, mandate record). Public endpoint. */
|
|
1223
|
+
verifyEvidence(doc: {
|
|
1224
|
+
payload: unknown;
|
|
1225
|
+
hash: string;
|
|
1226
|
+
signature: string;
|
|
1227
|
+
}): Promise<{
|
|
1228
|
+
type: string;
|
|
1229
|
+
ok: boolean;
|
|
1230
|
+
reason: string | null;
|
|
1231
|
+
}>;
|
|
1087
1232
|
/** Close an intent when the job ends. Further actions under it are off intent. */
|
|
1088
1233
|
completeIntent(intentId: string, status?: 'completed' | 'abandoned', outcome?: string): Promise<any>;
|
|
1089
1234
|
/** Intents for the org, newest first; filter by agent or status. */
|
|
@@ -1351,4 +1496,7 @@ interface DeviceLoginResult {
|
|
|
1351
1496
|
*/
|
|
1352
1497
|
declare function deviceLogin(opts: DeviceLoginOptions): Promise<DeviceLoginResult>;
|
|
1353
1498
|
|
|
1354
|
-
|
|
1499
|
+
/** The exact line a customer signs to withdraw a mandate (signedAt: ISO, within 5 minutes of sending). */
|
|
1500
|
+
declare function mandateWithdrawalLine(mandateId: string, signedAt: string): string;
|
|
1501
|
+
|
|
1502
|
+
export { Agent, AgentDelegationRecord, AgentRegistrationInput, AgentRegistrationResult, AuditEventInput, BeforeActionInput, BudgetSpend, CANONICAL_TOOL_CATALOGUE_VERSION, type CatalogueTool, type CommitmentKey, CreateMandateInput, CustomerSignature, DeclareIntentInput, DelegationLinkClaims, type DeviceLoginOptions, type DeviceLoginResult, GatewayCheckInput, HMAC_SHA256_PREFIX, HttpRequestLike, type HttpSignatureVerification, Intent, PermissionCheckResult, PermissionScope, type ReplayContext, type ReplayInputs, RuntimeDecision, SHA256_PREFIX, SharedMemoryEntry, SharedMemoryListResult, SharedMemoryWriteInput, SignHttpRequestOptions, SignHttpRequestResult, SuspendPreview, SwarmView, TokenBudget, TokenBudgetInput, TrustRecord, type VorimConfig, VorimDeniedError, VorimError, VorimSDK, WorkflowProvenanceGraph, canonicalIntent, canonicalPayloadV0, canonicalPayloadV1, commitPayload, createVorim as default, deviceLogin, eventDigest, foldTraceparent, hashPayload, hashPreviousEvent, hashSystemPrompt, hashTool, hashToolCatalogue, isDigest, isKeyedCommitment, jcsCanonicalise, mandateWithdrawalLine, prepareReplayContext };
|
package/dist/index.js
CHANGED
|
@@ -875,7 +875,7 @@ function canonicalIntent(value) {
|
|
|
875
875
|
const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
|
|
876
876
|
return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalIntent(obj[k])}`).join(",")}}`;
|
|
877
877
|
}
|
|
878
|
-
var SDK_VERSION = true ? "4.
|
|
878
|
+
var SDK_VERSION = true ? "4.5.0" : "0.0.0";
|
|
879
879
|
var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
|
|
880
880
|
function sleep(ms) {
|
|
881
881
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -1497,7 +1497,9 @@ var VorimSDK = class _VorimSDK {
|
|
|
1497
1497
|
trace_id: input.traceId,
|
|
1498
1498
|
span_id: input.spanId,
|
|
1499
1499
|
traceparent: input.traceparent,
|
|
1500
|
-
intent_id: input.intentId
|
|
1500
|
+
intent_id: input.intentId,
|
|
1501
|
+
case_ref: input.caseRef,
|
|
1502
|
+
mandate_id: input.mandateId
|
|
1501
1503
|
};
|
|
1502
1504
|
let raw;
|
|
1503
1505
|
try {
|
|
@@ -2033,7 +2035,11 @@ var VorimSDK = class _VorimSDK {
|
|
|
2033
2035
|
workflow_id: input.workflowId,
|
|
2034
2036
|
...signed,
|
|
2035
2037
|
expected_outcome: input.expectedOutcome,
|
|
2036
|
-
review_at: input.reviewAt
|
|
2038
|
+
review_at: input.reviewAt,
|
|
2039
|
+
case_ref: input.caseRef,
|
|
2040
|
+
product: input.product,
|
|
2041
|
+
vulnerable_customer: input.vulnerableCustomer,
|
|
2042
|
+
vulnerability_drivers: input.vulnerabilityDrivers
|
|
2037
2043
|
});
|
|
2038
2044
|
}
|
|
2039
2045
|
/**
|
|
@@ -2057,6 +2063,191 @@ var VorimSDK = class _VorimSDK {
|
|
|
2057
2063
|
const s = q.toString();
|
|
2058
2064
|
return this.get(`/intents/ledger${s ? `?${s}` : ""}`);
|
|
2059
2065
|
}
|
|
2066
|
+
// ─── Customer mandates ──────────────────────────────────────────────────
|
|
2067
|
+
/**
|
|
2068
|
+
* Create a pending customer mandate. Returns `signing_input`: the exact text
|
|
2069
|
+
* the customer's device must sign (ES256 raw r||s or DER, base64url) before
|
|
2070
|
+
* `activateMandate`. The private key stays on the customer's device.
|
|
2071
|
+
*
|
|
2072
|
+
* @example
|
|
2073
|
+
* const { mandate, signing_input } = await vorim.createMandate({
|
|
2074
|
+
* agentId, customerRef: 'cust_7731', alg: 'ES256', publicKeyJwk: phoneJwk,
|
|
2075
|
+
* terms: { actionTypes: ['initiate_payment'], maxAmount: 5000, currency: 'GBP', maxTotal: 20000 },
|
|
2076
|
+
* expiresAt: new Date(Date.now() + 30 * 86400e3).toISOString(),
|
|
2077
|
+
* });
|
|
2078
|
+
* // ... the customer's app signs signing_input ...
|
|
2079
|
+
* await vorim.activateMandate(mandate.mandate_id, signatureFromPhone);
|
|
2080
|
+
* await vorim.beforeAction({ agentId, actionType: 'initiate_payment', payload: { amount: 4000, currency: 'GBP' }, mandateId: mandate.mandate_id });
|
|
2081
|
+
*/
|
|
2082
|
+
async createMandate(input) {
|
|
2083
|
+
const t = input.terms;
|
|
2084
|
+
return this.post("/mandates", {
|
|
2085
|
+
agent_id: input.agentId,
|
|
2086
|
+
customer_ref: input.customerRef,
|
|
2087
|
+
alg: input.alg,
|
|
2088
|
+
public_key_jwk: input.publicKeyJwk,
|
|
2089
|
+
terms: {
|
|
2090
|
+
action_types: t.actionTypes,
|
|
2091
|
+
targets: t.targets,
|
|
2092
|
+
max_amount: t.maxAmount,
|
|
2093
|
+
currency: t.currency,
|
|
2094
|
+
max_total: t.maxTotal,
|
|
2095
|
+
max_uses: t.maxUses,
|
|
2096
|
+
read_only: t.readOnly,
|
|
2097
|
+
amount_field: t.amountField
|
|
2098
|
+
},
|
|
2099
|
+
expires_at: input.expiresAt,
|
|
2100
|
+
key_attestation: !input.keyAttestation ? void 0 : input.keyAttestation.format === "android-key" ? { format: "android-key", certificate_chain: input.keyAttestation.certificateChain, challenge: input.keyAttestation.challenge } : {
|
|
2101
|
+
format: "apple-app-attest",
|
|
2102
|
+
attestation_object: input.keyAttestation.attestationObject,
|
|
2103
|
+
key_id: input.keyAttestation.keyId,
|
|
2104
|
+
app_id: input.keyAttestation.appId,
|
|
2105
|
+
environment: input.keyAttestation.environment,
|
|
2106
|
+
challenge: input.keyAttestation.challenge
|
|
2107
|
+
},
|
|
2108
|
+
webauthn: input.webauthn ? { rp_id: input.webauthn.rpId, origin: input.webauthn.origin } : void 0
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* The mandate as an AP2 (Agent Payments Protocol v0.2) open Payment Mandate:
|
|
2113
|
+
* an SD-JWT signed by Vorim, `vct: "mandate.payment.open.1"`, with the
|
|
2114
|
+
* limits as AP2 constraints. `not_expressed_in_ap2` lists anything AP2
|
|
2115
|
+
* cannot carry.
|
|
2116
|
+
*/
|
|
2117
|
+
async exportMandateAp2(mandateId) {
|
|
2118
|
+
return this.get(`/mandates/${encodeURIComponent(mandateId)}/ap2`);
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Import an AP2 open Payment Mandate (SD-JWT, disclosures applied) as a
|
|
2122
|
+
* pending Vorim mandate. The issuer signature must verify against
|
|
2123
|
+
* `issuerJwk`; constraints Vorim cannot enforce are refused. The
|
|
2124
|
+
* customer's key (`cnf.jwk`) still signs `signing_input` to activate it.
|
|
2125
|
+
*/
|
|
2126
|
+
async importAp2Mandate(input) {
|
|
2127
|
+
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 });
|
|
2128
|
+
}
|
|
2129
|
+
/** A one-time challenge (10 minutes) for a hardware key attestation on `createMandate`. */
|
|
2130
|
+
async getAttestationChallenge() {
|
|
2131
|
+
return this.post("/mandates/attestation-challenge", {});
|
|
2132
|
+
}
|
|
2133
|
+
/** Activate a mandate with the customer's signature over its `signing_input`. Returns the countersigned record. */
|
|
2134
|
+
async activateMandate(mandateId, signature) {
|
|
2135
|
+
return this.post(`/mandates/${encodeURIComponent(mandateId)}/activate`, { signature });
|
|
2136
|
+
}
|
|
2137
|
+
/** The firm revokes a mandate; every later action under it is refused. */
|
|
2138
|
+
async revokeMandate(mandateId, reason) {
|
|
2139
|
+
return this.post(`/mandates/${encodeURIComponent(mandateId)}/revoke`, { reason });
|
|
2140
|
+
}
|
|
2141
|
+
async getMandate(mandateId) {
|
|
2142
|
+
return this.get(`/mandates/${encodeURIComponent(mandateId)}`);
|
|
2143
|
+
}
|
|
2144
|
+
async listMandates(params = {}) {
|
|
2145
|
+
const q = new URLSearchParams();
|
|
2146
|
+
if (params.agentId) q.set("agent_id", params.agentId);
|
|
2147
|
+
if (params.customerRef) q.set("customer_ref", params.customerRef);
|
|
2148
|
+
if (params.limit) q.set("limit", String(params.limit));
|
|
2149
|
+
const s = q.toString();
|
|
2150
|
+
return this.get(`/mandates${s ? `?${s}` : ""}`);
|
|
2151
|
+
}
|
|
2152
|
+
/** The countersigned record, every decision taken under the mandate, and a verification result. */
|
|
2153
|
+
async getMandateEvidence(mandateId) {
|
|
2154
|
+
return this.get(`/mandates/${encodeURIComponent(mandateId)}/evidence`);
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* The customer withdraws a mandate with their own key; no Vorim account
|
|
2158
|
+
* is involved. Sign `mandateWithdrawalLine(mandateId, signedAt)` on the
|
|
2159
|
+
* device (signedAt within 5 minutes of now) and pass the signature here.
|
|
2160
|
+
*/
|
|
2161
|
+
async withdrawMandate(mandateId, signedAt, signature) {
|
|
2162
|
+
return this.post(`/mandates/${encodeURIComponent(mandateId)}/withdraw`, { signed_at: signedAt, signature });
|
|
2163
|
+
}
|
|
2164
|
+
// ─── Evidence ───────────────────────────────────────────────────────────
|
|
2165
|
+
/** Case references seen in the last `days` (default 90). */
|
|
2166
|
+
async listCases(params = {}) {
|
|
2167
|
+
return this.get(`/evidence/cases${params.days ? `?days=${encodeURIComponent(String(params.days))}` : ""}`);
|
|
2168
|
+
}
|
|
2169
|
+
/** A platform-signed case pack for one case reference: decisions, approvals, intents, outcomes, mandates. */
|
|
2170
|
+
async getCasePack(caseRef) {
|
|
2171
|
+
return this.get(`/evidence/cases/${encodeURIComponent(caseRef)}/pack`);
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Keep a case pack, stamped by an RFC 3161 Time Stamping Authority unless
|
|
2175
|
+
* `timestamp: false`. If the TSA cannot be reached the pack is still kept
|
|
2176
|
+
* and `timestamp.ok` is false with the error.
|
|
2177
|
+
*/
|
|
2178
|
+
async storeCasePack(caseRef, input = {}) {
|
|
2179
|
+
return this.post(`/evidence/cases/${encodeURIComponent(caseRef)}/packs`, input);
|
|
2180
|
+
}
|
|
2181
|
+
async listStoredCasePacks(caseRef) {
|
|
2182
|
+
return this.get(`/evidence/cases/${encodeURIComponent(caseRef)}/packs`);
|
|
2183
|
+
}
|
|
2184
|
+
/** A kept case pack with its timestamp token and the openssl command to verify it. */
|
|
2185
|
+
async getStoredCasePack(id) {
|
|
2186
|
+
return this.get(`/evidence/case-pack/${encodeURIComponent(id)}`);
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Record what later happened to an action: `complaint`, `chargeback`,
|
|
2190
|
+
* `fraud_confirmed`, `refund_reversed` or `no_issue`. The savings report
|
|
2191
|
+
* uses these to show which bad outcomes a shadow rule would have caught.
|
|
2192
|
+
*/
|
|
2193
|
+
async recordActionOutcome(input) {
|
|
2194
|
+
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 });
|
|
2195
|
+
}
|
|
2196
|
+
/** What rules did and shadow rules would have done, costed at your own review assumptions. */
|
|
2197
|
+
async getSavingsReport(params = {}) {
|
|
2198
|
+
const q = new URLSearchParams();
|
|
2199
|
+
if (params.days) q.set("days", String(params.days));
|
|
2200
|
+
if (params.reviewMinutes) q.set("review_minutes", String(params.reviewMinutes));
|
|
2201
|
+
if (params.hourlyCost !== void 0) q.set("hourly_cost", String(params.hourlyCost));
|
|
2202
|
+
if (params.currency) q.set("currency", params.currency);
|
|
2203
|
+
if (params.agentId) q.set("agent_id", params.agentId);
|
|
2204
|
+
return this.get(`/evidence/savings?${q.toString()}`);
|
|
2205
|
+
}
|
|
2206
|
+
/** Consumer Duty outcomes by product, vulnerability and FG21/1 driver. */
|
|
2207
|
+
async getConsumerDutyReport(params = {}) {
|
|
2208
|
+
return this.get(`/evidence/consumer-duty${params.days ? `?days=${encodeURIComponent(String(params.days))}` : ""}`);
|
|
2209
|
+
}
|
|
2210
|
+
/** Record what a good (and poor) outcome looks like for a product. */
|
|
2211
|
+
async setOutcomeDefinition(input) {
|
|
2212
|
+
return this.put("/evidence/outcome-definitions", input);
|
|
2213
|
+
}
|
|
2214
|
+
/**
|
|
2215
|
+
* Run a sign-off pack for one agent: scenarios through the real gate in
|
|
2216
|
+
* shadow, answers to the risk committee's questions, signed and stored.
|
|
2217
|
+
*/
|
|
2218
|
+
async runSignoff(agentId, input = {}) {
|
|
2219
|
+
return this.post(`/evidence/signoffs/${encodeURIComponent(agentId)}`, input);
|
|
2220
|
+
}
|
|
2221
|
+
async listSignoffs(agentId) {
|
|
2222
|
+
return this.get(`/evidence/signoffs/${encodeURIComponent(agentId)}`);
|
|
2223
|
+
}
|
|
2224
|
+
async getSignoff(id) {
|
|
2225
|
+
return this.get(`/evidence/signoff/${encodeURIComponent(id)}`);
|
|
2226
|
+
}
|
|
2227
|
+
/** What changed between a sign-off pack and the one before it (or `againstId`): verdict, settings, scenarios, answers, permissions. */
|
|
2228
|
+
async getSignoffDiff(id, againstId) {
|
|
2229
|
+
return this.get(`/evidence/signoff/${encodeURIComponent(id)}/diff${againstId ? `?against=${encodeURIComponent(againstId)}` : ""}`);
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* For a bank's API edge: is this request signed by the agent, is the agent
|
|
2233
|
+
* still allowed to act, and is it inside a mandate for this customer?
|
|
2234
|
+
* Returns a platform-sealed verdict to keep.
|
|
2235
|
+
*/
|
|
2236
|
+
async gatewayCheck(input) {
|
|
2237
|
+
return this.post("/gateway/check", {
|
|
2238
|
+
request: input.request,
|
|
2239
|
+
mandate_id: input.mandateId,
|
|
2240
|
+
customer_ref: input.customerRef,
|
|
2241
|
+
action_type: input.actionType,
|
|
2242
|
+
amount: input.amount,
|
|
2243
|
+
currency: input.currency,
|
|
2244
|
+
max_age_seconds: input.maxAgeSeconds
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
/** Check any sealed Vorim document (case pack, sign-off, gateway verdict, mandate record). Public endpoint. */
|
|
2248
|
+
async verifyEvidence(doc) {
|
|
2249
|
+
return this.post("/evidence/verify", { payload: doc.payload, hash: doc.hash, signature: doc.signature });
|
|
2250
|
+
}
|
|
2060
2251
|
/** Close an intent when the job ends. Further actions under it are off intent. */
|
|
2061
2252
|
async completeIntent(intentId, status = "completed", outcome) {
|
|
2062
2253
|
return this.post(`/intents/${encodeURIComponent(intentId)}/complete`, { status, outcome });
|
|
@@ -2471,6 +2662,9 @@ async function deviceLogin(opts) {
|
|
|
2471
2662
|
wait = intervalMs;
|
|
2472
2663
|
}
|
|
2473
2664
|
}
|
|
2665
|
+
function mandateWithdrawalLine(mandateId, signedAt) {
|
|
2666
|
+
return `vorim-mandate-withdraw|v1|${mandateId}|${signedAt}`;
|
|
2667
|
+
}
|
|
2474
2668
|
export {
|
|
2475
2669
|
CANONICAL_TOOL_CATALOGUE_VERSION,
|
|
2476
2670
|
HMAC_SHA256_PREFIX,
|
|
@@ -2498,6 +2692,7 @@ export {
|
|
|
2498
2692
|
isDigest,
|
|
2499
2693
|
isKeyedCommitment,
|
|
2500
2694
|
jcsCanonicalise,
|
|
2695
|
+
mandateWithdrawalLine,
|
|
2501
2696
|
portableReceiptCanonicalBytes,
|
|
2502
2697
|
prepareReplayContext,
|
|
2503
2698
|
signHttpRequest,
|