@vorim/sdk 3.20.0 → 3.22.1
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 +7 -0
- package/README.md +12 -6
- package/dist/index.cjs +117 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -2
- package/dist/index.d.ts +43 -2
- package/dist/index.js +116 -3
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic.d.cts +2 -1
- package/dist/integrations/anthropic.d.ts +2 -1
- package/dist/integrations/ap2.d.cts +2 -1
- package/dist/integrations/ap2.d.ts +2 -1
- package/dist/integrations/aws-iam.d.cts +2 -1
- package/dist/integrations/aws-iam.d.ts +2 -1
- package/dist/integrations/bank-rails.d.cts +2 -1
- package/dist/integrations/bank-rails.d.ts +2 -1
- package/dist/integrations/circle.d.cts +2 -1
- package/dist/integrations/circle.d.ts +2 -1
- package/dist/integrations/cloudflare.d.cts +2 -1
- package/dist/integrations/cloudflare.d.ts +2 -1
- package/dist/integrations/coinbase-cdp.d.cts +2 -1
- package/dist/integrations/coinbase-cdp.d.ts +2 -1
- package/dist/integrations/commerce-agents.d.cts +2 -1
- package/dist/integrations/commerce-agents.d.ts +2 -1
- package/dist/integrations/crewai.d.cts +2 -1
- package/dist/integrations/crewai.d.ts +2 -1
- package/dist/integrations/entra.d.cts +2 -1
- package/dist/integrations/entra.d.ts +2 -1
- package/dist/integrations/fhir.d.cts +2 -1
- package/dist/integrations/fhir.d.ts +2 -1
- package/dist/integrations/grok.d.cts +2 -1
- package/dist/integrations/grok.d.ts +2 -1
- package/dist/integrations/guidewire.d.cts +2 -1
- package/dist/integrations/guidewire.d.ts +2 -1
- package/dist/integrations/hermes.d.cts +2 -1
- package/dist/integrations/hermes.d.ts +2 -1
- package/dist/integrations/jira.d.cts +2 -1
- package/dist/integrations/jira.d.ts +2 -1
- package/dist/integrations/langchain.d.cts +2 -1
- package/dist/integrations/langchain.d.ts +2 -1
- package/dist/integrations/langgraph.d.cts +2 -1
- package/dist/integrations/langgraph.d.ts +2 -1
- package/dist/integrations/legal.d.cts +2 -1
- package/dist/integrations/legal.d.ts +2 -1
- package/dist/integrations/life-sciences.d.cts +2 -1
- package/dist/integrations/life-sciences.d.ts +2 -1
- package/dist/integrations/linear.d.cts +2 -1
- package/dist/integrations/linear.d.ts +2 -1
- package/dist/integrations/lithic.d.cts +2 -1
- package/dist/integrations/lithic.d.ts +2 -1
- package/dist/integrations/llamaindex.d.cts +2 -1
- package/dist/integrations/llamaindex.d.ts +2 -1
- package/dist/integrations/marqeta.d.cts +2 -1
- package/dist/integrations/marqeta.d.ts +2 -1
- package/dist/integrations/modern-treasury.d.cts +2 -1
- package/dist/integrations/modern-treasury.d.ts +2 -1
- package/dist/integrations/muse.cjs +437 -0
- package/dist/integrations/muse.cjs.map +1 -0
- package/dist/integrations/muse.d.cts +72 -0
- package/dist/integrations/muse.d.ts +72 -0
- package/dist/integrations/muse.js +394 -0
- package/dist/integrations/muse.js.map +1 -0
- package/dist/integrations/nekuda.d.cts +2 -1
- package/dist/integrations/nekuda.d.ts +2 -1
- package/dist/integrations/okta.d.cts +2 -1
- package/dist/integrations/okta.d.ts +2 -1
- package/dist/integrations/openai.d.cts +2 -1
- package/dist/integrations/openai.d.ts +2 -1
- package/dist/integrations/openrouter.d.cts +2 -1
- package/dist/integrations/openrouter.d.ts +2 -1
- package/dist/integrations/paypal-agent.d.cts +2 -1
- package/dist/integrations/paypal-agent.d.ts +2 -1
- package/dist/integrations/perplexity.d.cts +2 -1
- package/dist/integrations/perplexity.d.ts +2 -1
- package/dist/integrations/plaid.d.cts +2 -1
- package/dist/integrations/plaid.d.ts +2 -1
- package/dist/integrations/ramp.d.cts +2 -1
- package/dist/integrations/ramp.d.ts +2 -1
- package/dist/integrations/shopify.d.cts +2 -1
- package/dist/integrations/shopify.d.ts +2 -1
- package/dist/integrations/siem.d.cts +1 -1
- package/dist/integrations/siem.d.ts +1 -1
- package/dist/integrations/skyfire.d.cts +2 -1
- package/dist/integrations/skyfire.d.ts +2 -1
- package/dist/integrations/stripe-acp.d.cts +2 -1
- package/dist/integrations/stripe-acp.d.ts +2 -1
- package/dist/integrations/stripe-issuing.d.cts +2 -1
- package/dist/integrations/stripe-issuing.d.ts +2 -1
- package/dist/integrations/truanon.d.cts +2 -1
- package/dist/integrations/truanon.d.ts +2 -1
- package/dist/integrations/typesafe.cjs +268 -0
- package/dist/integrations/typesafe.cjs.map +1 -0
- package/dist/integrations/typesafe.d.cts +145 -0
- package/dist/integrations/typesafe.d.ts +145 -0
- package/dist/integrations/typesafe.js +221 -0
- package/dist/integrations/typesafe.js.map +1 -0
- package/dist/integrations/ucp.d.cts +2 -1
- package/dist/integrations/ucp.d.ts +2 -1
- package/dist/integrations/vercel-ai.d.cts +2 -1
- package/dist/integrations/vercel-ai.d.ts +2 -1
- package/dist/integrations/x402.d.cts +2 -1
- package/dist/integrations/x402.d.ts +2 -1
- package/dist/{types-BmeluKHI.d.cts → types-BrDQAJdl.d.cts} +36 -1
- package/dist/{types-BmeluKHI.d.ts → types-BrDQAJdl.d.ts} +36 -1
- package/package.json +21 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-
|
|
2
|
-
export { k as AgentStatus, l as
|
|
1
|
+
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-BrDQAJdl.cjs';
|
|
2
|
+
export { k as AgentStatus, l as ApprovalAttestation, m as AuditEventType, n as AuditResult, o as BudgetEnforcement, p as BudgetScope, q as DecisionVerdict, r as WorkflowGraphEdge, s as WorkflowGraphEvent, t as WorkflowGraphNode } from './types-BrDQAJdl.cjs';
|
|
3
|
+
import { PortableSignedReceipt } from '@vorim/shared-types';
|
|
4
|
+
export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Replayable agent decision evidence helpers.
|
|
@@ -735,6 +737,33 @@ declare class VorimSDK {
|
|
|
735
737
|
timeoutMs?: number;
|
|
736
738
|
pollIntervalMs?: number;
|
|
737
739
|
}): Promise<RuntimeDecision>;
|
|
740
|
+
/**
|
|
741
|
+
* Mint a portable signed receipt for a decision: a self-contained,
|
|
742
|
+
* offline-verifiable statement that Vorim authorised this action.
|
|
743
|
+
*
|
|
744
|
+
* Use it when something OUTSIDE Vorim has to be convinced — a settlement
|
|
745
|
+
* layer, a downstream anchor, a counterparty's auditor. Verification needs
|
|
746
|
+
* the receipt and the public key from `GET /trust/keys`: no call back to
|
|
747
|
+
* Vorim, no chain, no network.
|
|
748
|
+
*
|
|
749
|
+
* Reproduce the signed bytes with `portableReceiptCanonicalBytes` from
|
|
750
|
+
* `@vorim/shared-types` (also re-exported here), then check `signature`
|
|
751
|
+
* against the key matching `kid`. Never re-derive those bytes by hand: the
|
|
752
|
+
* canonical form is defined once precisely so two implementations cannot
|
|
753
|
+
* drift into signatures that do not verify.
|
|
754
|
+
*
|
|
755
|
+
* Throws 409 when the decision is not an authorisation — a denial, a
|
|
756
|
+
* fail-open fallback, an unresolved escalation, or one a human refused.
|
|
757
|
+
* A receipt only ever means yes, so there is nothing to return for a no.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* const d = await vorim.beforeAction({ ... });
|
|
761
|
+
* if (d.decision === 'allow') {
|
|
762
|
+
* const receipt = await vorim.mintPortableSignedReceipt(d.decisionId);
|
|
763
|
+
* await settleWith(receipt); // the counterparty verifies it alone
|
|
764
|
+
* }
|
|
765
|
+
*/
|
|
766
|
+
mintPortableSignedReceipt(decisionId: string): Promise<PortableSignedReceipt>;
|
|
738
767
|
/**
|
|
739
768
|
* Map a snake_case decision row (from POST or GET) to the camelCase
|
|
740
769
|
* {@link RuntimeDecision}. The SDK has no generic camelizer, so the
|
|
@@ -770,6 +799,12 @@ declare class VorimSDK {
|
|
|
770
799
|
idempotencyKey?: string;
|
|
771
800
|
}): Promise<{
|
|
772
801
|
ingested: number;
|
|
802
|
+
events?: {
|
|
803
|
+
event_id: string;
|
|
804
|
+
digest?: string;
|
|
805
|
+
}[];
|
|
806
|
+
rejected_invalid_signature?: number;
|
|
807
|
+
replayed?: boolean;
|
|
773
808
|
}>;
|
|
774
809
|
/**
|
|
775
810
|
* Emit a batch of audit events (up to 1,000). Each event is signed
|
|
@@ -786,6 +821,12 @@ declare class VorimSDK {
|
|
|
786
821
|
idempotencyKey?: string;
|
|
787
822
|
}): Promise<{
|
|
788
823
|
ingested: number;
|
|
824
|
+
events?: {
|
|
825
|
+
event_id: string;
|
|
826
|
+
digest?: string;
|
|
827
|
+
}[];
|
|
828
|
+
rejected_invalid_signature?: number;
|
|
829
|
+
replayed?: boolean;
|
|
789
830
|
}>;
|
|
790
831
|
private warnOnPartialIngest;
|
|
791
832
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-
|
|
2
|
-
export { k as AgentStatus, l as
|
|
1
|
+
import { A as AgentRegistrationResult, R as RuntimeDecision, a as AgentRegistrationInput, T as TrustRecord, b as Agent, P as PermissionScope, c as PermissionCheckResult, D as DelegationLinkClaims, d as AgentDelegationRecord, W as WorkflowProvenanceGraph, C as CapabilityProfile, S as SharedMemoryWriteInput, e as SharedMemoryEntry, f as SharedMemoryListResult, B as BeforeActionInput, g as TokenBudgetInput, h as TokenBudget, i as BudgetSpend, j as AuditEventInput } from './types-BrDQAJdl.js';
|
|
2
|
+
export { k as AgentStatus, l as ApprovalAttestation, m as AuditEventType, n as AuditResult, o as BudgetEnforcement, p as BudgetScope, q as DecisionVerdict, r as WorkflowGraphEdge, s as WorkflowGraphEvent, t as WorkflowGraphNode } from './types-BrDQAJdl.js';
|
|
3
|
+
import { PortableSignedReceipt } from '@vorim/shared-types';
|
|
4
|
+
export { PortableSignedReceipt, portableReceiptCanonicalBytes } from '@vorim/shared-types';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Replayable agent decision evidence helpers.
|
|
@@ -735,6 +737,33 @@ declare class VorimSDK {
|
|
|
735
737
|
timeoutMs?: number;
|
|
736
738
|
pollIntervalMs?: number;
|
|
737
739
|
}): Promise<RuntimeDecision>;
|
|
740
|
+
/**
|
|
741
|
+
* Mint a portable signed receipt for a decision: a self-contained,
|
|
742
|
+
* offline-verifiable statement that Vorim authorised this action.
|
|
743
|
+
*
|
|
744
|
+
* Use it when something OUTSIDE Vorim has to be convinced — a settlement
|
|
745
|
+
* layer, a downstream anchor, a counterparty's auditor. Verification needs
|
|
746
|
+
* the receipt and the public key from `GET /trust/keys`: no call back to
|
|
747
|
+
* Vorim, no chain, no network.
|
|
748
|
+
*
|
|
749
|
+
* Reproduce the signed bytes with `portableReceiptCanonicalBytes` from
|
|
750
|
+
* `@vorim/shared-types` (also re-exported here), then check `signature`
|
|
751
|
+
* against the key matching `kid`. Never re-derive those bytes by hand: the
|
|
752
|
+
* canonical form is defined once precisely so two implementations cannot
|
|
753
|
+
* drift into signatures that do not verify.
|
|
754
|
+
*
|
|
755
|
+
* Throws 409 when the decision is not an authorisation — a denial, a
|
|
756
|
+
* fail-open fallback, an unresolved escalation, or one a human refused.
|
|
757
|
+
* A receipt only ever means yes, so there is nothing to return for a no.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* const d = await vorim.beforeAction({ ... });
|
|
761
|
+
* if (d.decision === 'allow') {
|
|
762
|
+
* const receipt = await vorim.mintPortableSignedReceipt(d.decisionId);
|
|
763
|
+
* await settleWith(receipt); // the counterparty verifies it alone
|
|
764
|
+
* }
|
|
765
|
+
*/
|
|
766
|
+
mintPortableSignedReceipt(decisionId: string): Promise<PortableSignedReceipt>;
|
|
738
767
|
/**
|
|
739
768
|
* Map a snake_case decision row (from POST or GET) to the camelCase
|
|
740
769
|
* {@link RuntimeDecision}. The SDK has no generic camelizer, so the
|
|
@@ -770,6 +799,12 @@ declare class VorimSDK {
|
|
|
770
799
|
idempotencyKey?: string;
|
|
771
800
|
}): Promise<{
|
|
772
801
|
ingested: number;
|
|
802
|
+
events?: {
|
|
803
|
+
event_id: string;
|
|
804
|
+
digest?: string;
|
|
805
|
+
}[];
|
|
806
|
+
rejected_invalid_signature?: number;
|
|
807
|
+
replayed?: boolean;
|
|
773
808
|
}>;
|
|
774
809
|
/**
|
|
775
810
|
* Emit a batch of audit events (up to 1,000). Each event is signed
|
|
@@ -786,6 +821,12 @@ declare class VorimSDK {
|
|
|
786
821
|
idempotencyKey?: string;
|
|
787
822
|
}): Promise<{
|
|
788
823
|
ingested: number;
|
|
824
|
+
events?: {
|
|
825
|
+
event_id: string;
|
|
826
|
+
digest?: string;
|
|
827
|
+
}[];
|
|
828
|
+
rejected_invalid_signature?: number;
|
|
829
|
+
replayed?: boolean;
|
|
789
830
|
}>;
|
|
790
831
|
private warnOnPartialIngest;
|
|
791
832
|
/**
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,71 @@ async function prepareReplayContext(inputs) {
|
|
|
74
74
|
return ctx;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// ../shared-types/src/index.ts
|
|
78
|
+
function jcsCanonicalise2(value) {
|
|
79
|
+
if (value === null) return "null";
|
|
80
|
+
if (value === true) return "true";
|
|
81
|
+
if (value === false) return "false";
|
|
82
|
+
if (typeof value === "number") {
|
|
83
|
+
if (!Number.isFinite(value)) {
|
|
84
|
+
throw new Error("jcsCanonicalise: NaN and Infinity are not JCS-valid");
|
|
85
|
+
}
|
|
86
|
+
const abs = Math.abs(value);
|
|
87
|
+
if (value !== 0 && (abs >= 1e21 || abs < 1e-4 || Number.isInteger(value) && abs > 2 ** 53)) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`jcsCanonicalise: numbers in the ranges where JS and Python formatting diverge (|x| >= 1e21, |x| < 1e-4, or integer |x| > 2^53) are not supported in signed metadata. Use a string instead of ${value}.`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return value.toString();
|
|
93
|
+
}
|
|
94
|
+
if (typeof value === "string") {
|
|
95
|
+
return JSON.stringify(value);
|
|
96
|
+
}
|
|
97
|
+
if (Array.isArray(value)) {
|
|
98
|
+
return "[" + value.map(jcsCanonicalise2).join(",") + "]";
|
|
99
|
+
}
|
|
100
|
+
if (typeof value === "object") {
|
|
101
|
+
const obj = value;
|
|
102
|
+
const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
|
|
103
|
+
const parts = keys.map((k) => JSON.stringify(k) + ":" + jcsCanonicalise2(obj[k]));
|
|
104
|
+
return "{" + parts.join(",") + "}";
|
|
105
|
+
}
|
|
106
|
+
throw new Error(`jcsCanonicalise: unsupported value type: ${typeof value}`);
|
|
107
|
+
}
|
|
108
|
+
function portableReceiptCanonicalBytes(receipt) {
|
|
109
|
+
return jcsCanonicalise2({
|
|
110
|
+
version: receipt.version,
|
|
111
|
+
org_id: receipt.org_id,
|
|
112
|
+
issued_at: receipt.issued_at,
|
|
113
|
+
canonical_form: receipt.canonical_form,
|
|
114
|
+
decision: {
|
|
115
|
+
decision_id: receipt.decision.decision_id,
|
|
116
|
+
verdict: receipt.decision.verdict,
|
|
117
|
+
agent_id: receipt.decision.agent_id,
|
|
118
|
+
required_scope: receipt.decision.required_scope,
|
|
119
|
+
action_type: receipt.decision.action_type,
|
|
120
|
+
action_target: receipt.decision.action_target,
|
|
121
|
+
policy_version: receipt.decision.policy_version,
|
|
122
|
+
decision_rule_id: receipt.decision.decision_rule_id,
|
|
123
|
+
requested_at: receipt.decision.requested_at,
|
|
124
|
+
expires_at: receipt.decision.expires_at
|
|
125
|
+
},
|
|
126
|
+
binding: {
|
|
127
|
+
original_intent_hash: receipt.binding.original_intent_hash,
|
|
128
|
+
effective_intent_hash: receipt.binding.effective_intent_hash,
|
|
129
|
+
policy_modified: receipt.binding.policy_modified
|
|
130
|
+
},
|
|
131
|
+
approval: receipt.approval === null ? null : {
|
|
132
|
+
resolution: receipt.approval.resolution,
|
|
133
|
+
resolved_at: receipt.approval.resolved_at,
|
|
134
|
+
approver_ref: receipt.approval.approver_ref,
|
|
135
|
+
alg: receipt.approval.alg,
|
|
136
|
+
kid: receipt.approval.kid,
|
|
137
|
+
signature: receipt.approval.signature
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
77
142
|
// src/commit.ts
|
|
78
143
|
var HMAC_SHA256_PREFIX = "hmac-sha256:";
|
|
79
144
|
var SHA256_PREFIX = "sha256:";
|
|
@@ -124,7 +189,7 @@ function isDigest(digest) {
|
|
|
124
189
|
}
|
|
125
190
|
|
|
126
191
|
// src/index.ts
|
|
127
|
-
var SDK_VERSION = true ? "3.
|
|
192
|
+
var SDK_VERSION = true ? "3.22.1" : "0.0.0";
|
|
128
193
|
var USER_AGENT = `vorim-sdk/${SDK_VERSION}`;
|
|
129
194
|
function sleep(ms) {
|
|
130
195
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -151,6 +216,22 @@ async function eventDigest(event) {
|
|
|
151
216
|
function idempotencyHeader(key) {
|
|
152
217
|
return key ? { "Idempotency-Key": key } : void 0;
|
|
153
218
|
}
|
|
219
|
+
function toApprovalAttestation(raw) {
|
|
220
|
+
if (!raw || typeof raw !== "object") return null;
|
|
221
|
+
if (raw.resolution !== "approved") return null;
|
|
222
|
+
if (raw.alg !== "Ed25519") return null;
|
|
223
|
+
if (typeof raw.kid !== "string" || !raw.kid) return null;
|
|
224
|
+
if (typeof raw.signature !== "string" || !raw.signature.startsWith("ed25519:")) return null;
|
|
225
|
+
if (typeof raw.resolved_at !== "string" || Number.isNaN(Date.parse(raw.resolved_at))) return null;
|
|
226
|
+
return {
|
|
227
|
+
resolution: "approved",
|
|
228
|
+
resolvedAt: raw.resolved_at,
|
|
229
|
+
approverRef: typeof raw.approver_ref === "string" ? raw.approver_ref : null,
|
|
230
|
+
alg: "Ed25519",
|
|
231
|
+
kid: raw.kid,
|
|
232
|
+
signature: raw.signature
|
|
233
|
+
};
|
|
234
|
+
}
|
|
154
235
|
var VorimSDK = class _VorimSDK {
|
|
155
236
|
apiKey;
|
|
156
237
|
baseUrl;
|
|
@@ -720,7 +801,8 @@ var VorimSDK = class _VorimSDK {
|
|
|
720
801
|
latencyMs: 0,
|
|
721
802
|
isFallback: true,
|
|
722
803
|
policyVersion: 0,
|
|
723
|
-
escalationResolution: null
|
|
804
|
+
escalationResolution: null,
|
|
805
|
+
approval: null
|
|
724
806
|
};
|
|
725
807
|
}
|
|
726
808
|
throw err;
|
|
@@ -793,6 +875,35 @@ var VorimSDK = class _VorimSDK {
|
|
|
793
875
|
{ decisionId }
|
|
794
876
|
);
|
|
795
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Mint a portable signed receipt for a decision: a self-contained,
|
|
880
|
+
* offline-verifiable statement that Vorim authorised this action.
|
|
881
|
+
*
|
|
882
|
+
* Use it when something OUTSIDE Vorim has to be convinced — a settlement
|
|
883
|
+
* layer, a downstream anchor, a counterparty's auditor. Verification needs
|
|
884
|
+
* the receipt and the public key from `GET /trust/keys`: no call back to
|
|
885
|
+
* Vorim, no chain, no network.
|
|
886
|
+
*
|
|
887
|
+
* Reproduce the signed bytes with `portableReceiptCanonicalBytes` from
|
|
888
|
+
* `@vorim/shared-types` (also re-exported here), then check `signature`
|
|
889
|
+
* against the key matching `kid`. Never re-derive those bytes by hand: the
|
|
890
|
+
* canonical form is defined once precisely so two implementations cannot
|
|
891
|
+
* drift into signatures that do not verify.
|
|
892
|
+
*
|
|
893
|
+
* Throws 409 when the decision is not an authorisation — a denial, a
|
|
894
|
+
* fail-open fallback, an unresolved escalation, or one a human refused.
|
|
895
|
+
* A receipt only ever means yes, so there is nothing to return for a no.
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* const d = await vorim.beforeAction({ ... });
|
|
899
|
+
* if (d.decision === 'allow') {
|
|
900
|
+
* const receipt = await vorim.mintPortableSignedReceipt(d.decisionId);
|
|
901
|
+
* await settleWith(receipt); // the counterparty verifies it alone
|
|
902
|
+
* }
|
|
903
|
+
*/
|
|
904
|
+
async mintPortableSignedReceipt(decisionId) {
|
|
905
|
+
return this.get(`/runtime/decisions/${decisionId}/receipt`);
|
|
906
|
+
}
|
|
796
907
|
/**
|
|
797
908
|
* Map a snake_case decision row (from POST or GET) to the camelCase
|
|
798
909
|
* {@link RuntimeDecision}. The SDK has no generic camelizer, so the
|
|
@@ -831,7 +942,8 @@ var VorimSDK = class _VorimSDK {
|
|
|
831
942
|
latencyMs: raw?.latency_ms ?? 0,
|
|
832
943
|
isFallback: raw?.is_fallback ?? !hasVerdict,
|
|
833
944
|
policyVersion: raw?.policy_version ?? 0,
|
|
834
|
-
escalationResolution: resolution
|
|
945
|
+
escalationResolution: resolution,
|
|
946
|
+
approval: toApprovalAttestation(raw?.approval)
|
|
835
947
|
};
|
|
836
948
|
}
|
|
837
949
|
// ─── Audit ────────────────────────────────────────────────────────
|
|
@@ -1342,6 +1454,7 @@ export {
|
|
|
1342
1454
|
isDigest,
|
|
1343
1455
|
isKeyedCommitment,
|
|
1344
1456
|
jcsCanonicalise,
|
|
1457
|
+
portableReceiptCanonicalBytes,
|
|
1345
1458
|
prepareReplayContext
|
|
1346
1459
|
};
|
|
1347
1460
|
//# sourceMappingURL=index.js.map
|