@t3foundry/tasra-sdk 0.3.1 → 0.4.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 +1067 -28
- package/README.md +15 -0
- package/dist/app/approvals.d.ts +66 -4
- package/dist/app/approvals.js +153 -16
- package/dist/app/authorization.d.ts +1 -1
- package/dist/app/authorization.js +1 -1
- package/dist/app/browser.d.ts +63 -0
- package/dist/app/browser.js +242 -0
- package/dist/app/client.d.ts +114 -13
- package/dist/app/client.js +302 -76
- package/dist/app/identity.js +21 -9
- package/dist/app/index.d.ts +28 -3
- package/dist/app/index.js +16 -1
- package/dist/app/memory-store.d.ts +7 -0
- package/dist/app/memory-store.js +55 -0
- package/dist/app/node.d.ts +34 -6
- package/dist/app/node.js +387 -64
- package/dist/app/paid-allowance.d.ts +325 -0
- package/dist/app/paid-allowance.js +1290 -0
- package/dist/app/paid-approval.d.ts +122 -0
- package/dist/app/paid-approval.js +379 -0
- package/dist/app/paid-journal.d.ts +51 -0
- package/dist/app/paid-journal.js +117 -0
- package/dist/app/paid-keys.d.ts +12 -0
- package/dist/app/paid-keys.js +20 -0
- package/dist/app/paid-operation.d.ts +821 -0
- package/dist/app/paid-operation.js +1720 -0
- package/dist/app/paid-reservation.d.ts +157 -0
- package/dist/app/paid-reservation.js +323 -0
- package/dist/app/paid-session.d.ts +147 -0
- package/dist/app/paid-session.js +578 -0
- package/dist/app/payer-queue.d.ts +11 -0
- package/dist/app/payer-queue.js +27 -0
- package/dist/app/policy-bootstrap.d.ts +342 -0
- package/dist/app/policy-bootstrap.js +365 -0
- package/dist/app/policy-operation.d.ts +47 -0
- package/dist/app/policy-operation.js +101 -0
- package/dist/app/ready-slot.d.ts +12 -0
- package/dist/app/ready-slot.js +5 -2
- package/dist/app/rotation-lock.d.ts +38 -0
- package/dist/app/rotation-lock.js +42 -0
- package/dist/app/session-decrypt.d.ts +135 -0
- package/dist/app/session-decrypt.js +335 -0
- package/dist/app/session-grants.d.ts +349 -0
- package/dist/app/session-grants.js +811 -0
- package/dist/app/signing-intents.d.ts +78 -0
- package/dist/app/signing-intents.js +95 -0
- package/dist/app/store-commit.d.ts +63 -0
- package/dist/app/store-commit.js +126 -0
- package/dist/app/store-errors.d.ts +8 -0
- package/dist/app/store-errors.js +11 -0
- package/dist/app/tasra-client.d.ts +2 -0
- package/dist/app/tasra-client.js +1 -1
- package/dist/app/wallet.js +4 -1
- package/dist/auth/holderProof.d.ts +3 -0
- package/dist/auth/holderProof.js +8 -7
- package/dist/auth/verifier.d.ts +4 -2
- package/dist/auth/verifier.js +5 -2
- package/dist/chain/abis/index.d.ts +6178 -4101
- package/dist/chain/abis/index.js +3 -0
- package/dist/chain/abis/keyRegistry.d.ts +256 -0
- package/dist/chain/abis/keyRegistry.js +333 -0
- package/dist/chain/abis/prepaidFaultOracle.d.ts +321 -0
- package/dist/chain/abis/prepaidFaultOracle.js +413 -0
- package/dist/chain/abis/settlement.d.ts +2203 -703
- package/dist/chain/abis/settlement.js +2685 -764
- package/dist/chain/allowance.d.ts +358 -0
- package/dist/chain/allowance.js +800 -0
- package/dist/chain/billing.d.ts +85 -0
- package/dist/chain/billing.js +197 -0
- package/dist/chain/chainId.d.ts +13 -0
- package/dist/chain/chainId.js +26 -0
- package/dist/chain/client.d.ts +15 -1
- package/dist/chain/client.js +57 -1
- package/dist/chain/commitmentRecovery.d.ts +51 -0
- package/dist/chain/commitmentRecovery.js +38 -0
- package/dist/chain/committeeClient.d.ts +17 -10
- package/dist/chain/committeeClient.js +64 -16
- package/dist/chain/committeeDraw.d.ts +12 -0
- package/dist/chain/committeeDraw.js +56 -0
- package/dist/chain/custodyHealth.d.ts +212 -0
- package/dist/chain/custodyHealth.js +365 -0
- package/dist/chain/deployments.js +2 -0
- package/dist/chain/events.js +2 -0
- package/dist/chain/headFollower.d.ts +77 -0
- package/dist/chain/headFollower.js +219 -0
- package/dist/chain/headPrefetch.d.ts +23 -0
- package/dist/chain/headPrefetch.js +67 -0
- package/dist/chain/index.d.ts +50 -8
- package/dist/chain/index.js +28 -3
- package/dist/chain/keeperExecution.d.ts +44 -0
- package/dist/chain/keeperExecution.js +127 -0
- package/dist/chain/keeperRecovery.d.ts +78 -0
- package/dist/chain/keeperRecovery.js +91 -0
- package/dist/chain/node.d.ts +24 -1
- package/dist/chain/node.js +88 -43
- package/dist/chain/offchain.d.ts +2 -0
- package/dist/chain/paidAgentTransport.d.ts +38 -0
- package/dist/chain/paidAgentTransport.js +1 -0
- package/dist/chain/paidEpoch.d.ts +66 -0
- package/dist/chain/paidEpoch.js +139 -0
- package/dist/chain/paidPacing.d.ts +81 -0
- package/dist/chain/paidPacing.js +136 -0
- package/dist/chain/pinnedReads.d.ts +49 -0
- package/dist/chain/pinnedReads.js +218 -0
- package/dist/chain/prepaid.d.ts +383 -0
- package/dist/chain/prepaid.js +1046 -0
- package/dist/chain/prepaidEscape.d.ts +274 -0
- package/dist/chain/prepaidEscape.js +432 -0
- package/dist/chain/prepaidFault.d.ts +94 -0
- package/dist/chain/prepaidFault.js +148 -0
- package/dist/chain/receipt.d.ts +24 -0
- package/dist/chain/receipt.js +82 -0
- package/dist/chain/registeredAgent.d.ts +68 -3
- package/dist/chain/registeredAgent.js +143 -42
- package/dist/chain/registeredOperation.d.ts +10 -1
- package/dist/chain/registeredOperation.js +18 -3
- package/dist/chain/registeredPaidAgent.d.ts +254 -0
- package/dist/chain/registeredPaidAgent.js +889 -0
- package/dist/chain/registeredRelay.d.ts +31 -1
- package/dist/chain/registeredRelay.js +164 -43
- package/dist/chain/relayVoucher.d.ts +64 -0
- package/dist/chain/relayVoucher.js +69 -0
- package/dist/chain/reservation.d.ts +239 -0
- package/dist/chain/reservation.js +746 -0
- package/dist/chain/reshareRoster.d.ts +64 -0
- package/dist/chain/reshareRoster.js +85 -0
- package/dist/chain/revertReason.d.ts +8 -0
- package/dist/chain/revertReason.js +2 -1
- package/dist/chain/rotationLock.d.ts +130 -0
- package/dist/chain/rotationLock.js +168 -0
- package/dist/chain/serviceRequestPolicy.d.ts +47 -0
- package/dist/chain/serviceRequestPolicy.js +86 -0
- package/dist/chain/services.d.ts +7 -0
- package/dist/chain/services.js +44 -4
- package/dist/chain/slotClient.js +11 -2
- package/dist/chain/slotHandoff.d.ts +81 -0
- package/dist/chain/slotHandoff.js +166 -0
- package/dist/chain/slotSeed.d.ts +47 -5
- package/dist/chain/slotSeed.js +173 -42
- package/dist/chain/verifierSnapshot.d.ts +36 -0
- package/dist/chain/verifierSnapshot.js +197 -0
- package/dist/chain/write.d.ts +111 -21
- package/dist/chain/write.js +378 -146
- package/dist/committee/blsSharing.d.ts +53 -0
- package/dist/committee/blsSharing.js +90 -0
- package/dist/committee/client.d.ts +62 -23
- package/dist/committee/client.js +288 -72
- package/dist/committee/dual-operation.d.ts +165 -0
- package/dist/committee/dual-operation.js +229 -0
- package/dist/committee/dual-sign.d.ts +26 -1
- package/dist/committee/dual-sign.js +85 -7
- package/dist/committee/ecdsa.d.ts +38 -0
- package/dist/committee/ecdsa.js +87 -15
- package/dist/committee/evidence.d.ts +30 -0
- package/dist/committee/evidence.js +65 -0
- package/dist/committee/execution.d.ts +414 -0
- package/dist/committee/execution.js +446 -0
- package/dist/committee/extraction.js +33 -26
- package/dist/committee/index.d.ts +30 -7
- package/dist/committee/index.js +18 -6
- package/dist/committee/keeperExecution.d.ts +37 -0
- package/dist/committee/keeperExecution.js +141 -0
- package/dist/committee/oauth.d.ts +14 -4
- package/dist/committee/oauth.js +17 -5
- package/dist/committee/payment.d.ts +369 -0
- package/dist/committee/payment.js +339 -0
- package/dist/committee/recovery.d.ts +136 -0
- package/dist/committee/recovery.js +204 -0
- package/dist/committee/recoveryJson.d.ts +2 -0
- package/dist/committee/recoveryJson.js +87 -0
- package/dist/committee/request.d.ts +63 -27
- package/dist/committee/request.js +77 -66
- package/dist/committee/session-grant.d.ts +320 -0
- package/dist/committee/session-grant.js +397 -0
- package/dist/committee/status-refresh.d.ts +257 -0
- package/dist/committee/status-refresh.js +619 -0
- package/dist/committee/token.d.ts +163 -15
- package/dist/committee/token.js +247 -10
- package/dist/crypto/bn254.d.ts +70 -0
- package/dist/crypto/bn254.js +222 -0
- package/dist/crypto/ibe.d.ts +32 -0
- package/dist/crypto/ibe.js +56 -8
- package/dist/crypto/index.d.ts +1 -1
- package/dist/crypto/index.js +1 -1
- package/dist/crypto/kem.d.ts +31 -0
- package/dist/crypto/kem.js +113 -7
- package/dist/crypto/recipient.d.ts +75 -0
- package/dist/crypto/recipient.js +107 -0
- package/dist/decryption/client.d.ts +10 -16
- package/dist/decryption/client.js +8 -76
- package/dist/decryption/index.d.ts +2 -0
- package/dist/decryption/index.js +2 -0
- package/dist/decryption/sealed.d.ts +72 -0
- package/dist/decryption/sealed.js +147 -0
- package/dist/decryption/session.d.ts +115 -0
- package/dist/decryption/session.js +358 -0
- package/dist/errors.d.ts +406 -1
- package/dist/errors.js +400 -5
- package/dist/index.d.ts +9 -2
- package/dist/index.js +6 -1
- package/dist/internal/bounded.d.ts +66 -0
- package/dist/internal/bounded.js +126 -0
- package/dist/internal/network.d.ts +4 -0
- package/dist/internal/network.js +40 -0
- package/dist/internal/retryAfter.d.ts +8 -0
- package/dist/internal/retryAfter.js +28 -0
- package/dist/internal/sleep.d.ts +6 -0
- package/dist/internal/sleep.js +15 -0
- package/dist/internal/typedData.d.ts +13 -0
- package/dist/internal/typedData.js +77 -0
- package/dist/internal/viemErrors.d.ts +26 -0
- package/dist/internal/viemErrors.js +49 -0
- package/dist/oid4vp/binding.d.ts +27 -1
- package/dist/oid4vp/binding.js +36 -1
- package/dist/oid4vp/jose.d.ts +4 -2
- package/dist/oid4vp/jose.js +39 -7
- package/dist/oid4vp/request-object.d.ts +61 -4
- package/dist/oid4vp/request-object.js +140 -5
- package/dist/oid4vp/verifier-agent.d.ts +18 -8
- package/dist/oid4vp/verifier-agent.js +48 -6
- package/dist/oid4vp/wallet.d.ts +2 -4
- package/dist/oid4vp/wallet.js +1 -0
- package/dist/retry.d.ts +78 -0
- package/dist/retry.js +137 -0
- package/dist/signing/frost.d.ts +1 -1
- package/dist/verifier-agent/index.d.ts +41 -5
- package/dist/verifier-agent/index.js +124 -9
- package/dist/verifier-agent/payment.d.ts +7 -0
- package/dist/verifier-agent/payment.js +17 -0
- package/docs/api.md +8 -2
- package/docs/application-api.md +25 -2
- package/docs/chain.md +155 -9
- package/docs/consumer-migrations.md +61 -0
- package/docs/encrypted-notes.md +3 -2
- package/docs/encryption.md +4 -2
- package/docs/errors.md +14 -1
- package/docs/flows.md +2 -2
- package/docs/funding.md +902 -0
- package/docs/native-approvals.md +63 -0
- package/docs/reference/README.md +9 -8
- package/docs/reference/app-browser.md +232 -0
- package/docs/reference/app-node.md +38 -8
- package/docs/reference/app.md +4621 -805
- package/docs/reference/chain-node.md +74 -16
- package/docs/reference/chain.md +6740 -1592
- package/docs/reference/committee.md +5630 -987
- package/docs/reference/main.md +1439 -140
- package/docs/reference/oid4vp.md +297 -144
- package/docs/reference/verifier-agent.md +77 -35
- package/docs/signing.md +6 -0
- package/examples/encrypted-notes.ts +21 -6
- package/examples/getting-started.ts +2 -7
- package/examples/live-config.ts +24 -17
- package/package.json +17 -5
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { ed25519 } from '@noble/curves/ed25519';
|
|
2
|
+
import { equalBytes } from '@noble/curves/utils.js';
|
|
3
|
+
import { keccak256, toHex } from 'viem';
|
|
4
|
+
import { bytesToHex } from '@noble/hashes/utils';
|
|
5
|
+
import { BoundedCache } from '../internal/bounded.js';
|
|
6
|
+
import { recoverTypedDataSigner, typedDataHash as hashTypedData } from '../internal/typedData.js';
|
|
7
|
+
import { canonicalize } from '../auth/oid4vp.js';
|
|
8
|
+
import { protocolHex } from './receipts.js';
|
|
9
|
+
import { assertPaymentIntentWire, paymentIntentHash, paymentIntentTypedData, prepaidRequestId } from './payment.js';
|
|
10
|
+
/** Separate creator-consent domain; original payment commitments remain unchanged. */
|
|
11
|
+
export const EXECUTION_CERTIFICATE_DOMAIN = 'Keykeeper Client Execution Certificate';
|
|
12
|
+
/** Client stage approvals bind complete request bodies and assigned operator keys. */
|
|
13
|
+
export const EXECUTION_APPROVAL_DOMAIN = 'Keykeeper Client Stage Approval';
|
|
14
|
+
/** Client consent to one exact session and independently approved registered agent. */
|
|
15
|
+
export const EXECUTION_INITIALIZATION_DOMAIN = 'Keykeeper Client Session Initialization';
|
|
16
|
+
/** Maximum complete unsigned request size shared with the Rust verifier. */
|
|
17
|
+
export const MAX_EXECUTION_BODY_BYTES = 2 * 1024 * 1024;
|
|
18
|
+
const STAGES = { coordinator: 0, contributor: 1, presentation_sign: 2, presentation_attest: 3, credential: 4 };
|
|
19
|
+
const COMMON_FIELDS = [
|
|
20
|
+
{ name: 'chainId', type: 'uint256' }, { name: 'settlement', type: 'address' },
|
|
21
|
+
{ name: 'keyRegistry', type: 'address' }, { name: 'slotId', type: 'bytes32' },
|
|
22
|
+
{ name: 'paymentHash', type: 'bytes32' }, { name: 'requestId', type: 'bytes32' },
|
|
23
|
+
{ name: 'sessionCommitment', type: 'bytes32' },
|
|
24
|
+
];
|
|
25
|
+
const CERTIFICATE_TYPES = { ClientExecutionCertificate: [...COMMON_FIELDS,
|
|
26
|
+
{ name: 'executionKey', type: 'bytes32' }, { name: 'expires', type: 'uint64' },
|
|
27
|
+
] };
|
|
28
|
+
const APPROVAL_TYPES = { ClientStageApproval: [...COMMON_FIELDS,
|
|
29
|
+
{ name: 'certificateHash', type: 'bytes32' }, { name: 'stage', type: 'uint8' },
|
|
30
|
+
{ name: 'operatorKey', type: 'bytes32' }, { name: 'action', type: 'uint8' },
|
|
31
|
+
{ name: 'payloadDigest', type: 'bytes32' }, { name: 'bodyHash', type: 'bytes32' },
|
|
32
|
+
{ name: 'expires', type: 'uint64' },
|
|
33
|
+
] };
|
|
34
|
+
const INITIALIZATION_TYPES = { ClientSessionInitialization: [...COMMON_FIELDS,
|
|
35
|
+
{ name: 'certificateHash', type: 'bytes32' }, { name: 'profileHash', type: 'bytes32' },
|
|
36
|
+
{ name: 'bodyHash', type: 'bytes32' }, { name: 'expires', type: 'uint64' },
|
|
37
|
+
] };
|
|
38
|
+
const ACTIONS = { sign: 0, decrypt: 1, 'eoa-sign': 2, 'ibe-extract': 3, 'dual-approve': 6 };
|
|
39
|
+
function integer(value) {
|
|
40
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
41
|
+
throw new Error('Invalid execution timestamp or chain ID');
|
|
42
|
+
}
|
|
43
|
+
// Exact 32-byte encodings already proven to be strict prime-order points. One paid operation
|
|
44
|
+
// re-checks the same certificate and keeper keys a dozen times; the torsion check is a full
|
|
45
|
+
// scalar multiplication each time. Only keys that PASSED are stored, keyed by their exact bytes.
|
|
46
|
+
const primeOrderKeys = new BoundedCache(1024);
|
|
47
|
+
function strongKey(key) {
|
|
48
|
+
const bytes = protocolHex(key, 32, 'execution public key');
|
|
49
|
+
primeOrderKeys.getOrCompute(bytesToHex(bytes), () => {
|
|
50
|
+
const point = ed25519.Point.fromHex(bytes, false);
|
|
51
|
+
if (point.isSmallOrder() || !point.isTorsionFree())
|
|
52
|
+
throw new Error('Execution public key must be a prime-order Ed25519 point');
|
|
53
|
+
return true;
|
|
54
|
+
});
|
|
55
|
+
return bytes;
|
|
56
|
+
}
|
|
57
|
+
// Strict (non-ZIP-215) Ed25519 verifications that PASSED, keyed by the exact signature, message and
|
|
58
|
+
// key bytes (fixed 64/32/32 lengths): an approval the client just signed and checked is checked
|
|
59
|
+
// again by the keeper-request wrapper with the identical triple. A failure is never stored.
|
|
60
|
+
const verifiedSignatures = new BoundedCache(1024);
|
|
61
|
+
function strictSignature(signature, message, key) {
|
|
62
|
+
if (signature.length !== 64 || message.length !== 32 || key.length !== 32)
|
|
63
|
+
return ed25519.verify(signature, message, key, { zip215: false });
|
|
64
|
+
const id = bytesToHex(signature) + bytesToHex(message) + bytesToHex(key);
|
|
65
|
+
if (verifiedSignatures.peek(id))
|
|
66
|
+
return true;
|
|
67
|
+
if (!ed25519.verify(signature, message, key, { zip215: false }))
|
|
68
|
+
return false;
|
|
69
|
+
verifiedSignatures.getOrCompute(id, () => true);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
function stage(stage) {
|
|
73
|
+
if (!Object.hasOwn(STAGES, stage))
|
|
74
|
+
throw new Error('Unknown execution stage');
|
|
75
|
+
return STAGES[stage];
|
|
76
|
+
}
|
|
77
|
+
function exactObject(value, keys) {
|
|
78
|
+
if (!value || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
79
|
+
throw new Error('Execution envelope must be a plain object');
|
|
80
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
81
|
+
if (Object.getOwnPropertySymbols(value).length || Object.keys(descriptors).length !== keys.length
|
|
82
|
+
|| keys.some(key => !Object.hasOwn(descriptors, key))
|
|
83
|
+
|| Object.values(descriptors).some(descriptor => !descriptor.enumerable || !Object.hasOwn(descriptor, 'value')))
|
|
84
|
+
throw new Error('Execution envelope has missing, unknown or non-JSON fields');
|
|
85
|
+
}
|
|
86
|
+
function certificateShape(certificate) {
|
|
87
|
+
exactObject(certificate, ['execution_key', 'expires', 'creator_signature']);
|
|
88
|
+
}
|
|
89
|
+
// Validate the caller's object, then hash the SNAPSHOT once: the snapshot is what every later
|
|
90
|
+
// comparison reads, so its hash is returned with it rather than recomputed per comparison.
|
|
91
|
+
function expectedSnapshot(expected) {
|
|
92
|
+
exactObject(expected, ['stage', 'operatorKey', 'body']);
|
|
93
|
+
stage(expected.stage);
|
|
94
|
+
strongKey(expected.operatorKey);
|
|
95
|
+
bodyShape(expected.body);
|
|
96
|
+
const snapshot = structuredClone(expected);
|
|
97
|
+
return { expected: snapshot, bodyHash: executionBodyHash(snapshot.body) };
|
|
98
|
+
}
|
|
99
|
+
function common(payment) {
|
|
100
|
+
assertPaymentIntentWire(payment);
|
|
101
|
+
return { chainId: BigInt(payment.chain_id), settlement: payment.settlement, keyRegistry: payment.key_registry,
|
|
102
|
+
slotId: payment.slot, paymentHash: paymentIntentHash(payment), requestId: prepaidRequestId(payment), sessionCommitment: payment.session_commitment };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Reconstruct the creator certificate typed data from the original payment.
|
|
106
|
+
* @param payment Locally retained payment; signing this data does not reserve or spend funds.
|
|
107
|
+
* @param certificate Public execution key and expiry to certify.
|
|
108
|
+
*/
|
|
109
|
+
export function executionCertificateTypedData(payment, certificate) {
|
|
110
|
+
integer(certificate.expires);
|
|
111
|
+
strongKey(certificate.execution_key);
|
|
112
|
+
if (certificate.expires === 0 || certificate.expires > payment.expires)
|
|
113
|
+
throw new Error('Execution certificate exceeds payment expiry');
|
|
114
|
+
return { domain: { name: EXECUTION_CERTIFICATE_DOMAIN, version: '1', chainId: payment.chain_id, verifyingContract: payment.settlement },
|
|
115
|
+
primaryType: 'ClientExecutionCertificate', types: CERTIFICATE_TYPES,
|
|
116
|
+
message: { ...common(payment), executionKey: certificate.execution_key, expires: BigInt(certificate.expires) } };
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Reconstruct the complete stage typed data; callers never sign an agent's opaque hash.
|
|
120
|
+
* @param payment Original independently retained payment.
|
|
121
|
+
* @param approval Stage, target and locally recomputed body commitment.
|
|
122
|
+
*/
|
|
123
|
+
export function executionApprovalTypedData(payment, approval) {
|
|
124
|
+
integer(approval.expires);
|
|
125
|
+
strongKey(approval.operator_key);
|
|
126
|
+
if (approval.expires === 0 || approval.expires > approval.certificate.expires || /^0x0{64}$/i.test(approval.body_hash))
|
|
127
|
+
throw new Error('Invalid execution approval expiry or body hash');
|
|
128
|
+
protocolHex(approval.body_hash, 32, 'execution body hash');
|
|
129
|
+
return { domain: { name: EXECUTION_APPROVAL_DOMAIN, version: '1', chainId: payment.chain_id, verifyingContract: payment.settlement },
|
|
130
|
+
primaryType: 'ClientStageApproval', types: APPROVAL_TYPES,
|
|
131
|
+
message: { ...common(payment), certificateHash: hashTypedData(executionCertificateTypedData(payment, approval.certificate)),
|
|
132
|
+
stage: stage(approval.stage), operatorKey: approval.operator_key, action: ACTIONS[payment.action],
|
|
133
|
+
payloadDigest: payment.payload_digest, bodyHash: approval.body_hash, expires: BigInt(approval.expires) } };
|
|
134
|
+
}
|
|
135
|
+
function jsonShape(value, depth, budget) {
|
|
136
|
+
if (depth > 32 || budget.remaining-- === 0)
|
|
137
|
+
throw new Error('Execution body exceeds nesting or node bound');
|
|
138
|
+
if (typeof value === 'string') {
|
|
139
|
+
unicode(value);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (value === null || typeof value === 'boolean')
|
|
143
|
+
return;
|
|
144
|
+
if (typeof value === 'number' && Number.isSafeInteger(value))
|
|
145
|
+
return;
|
|
146
|
+
if (Array.isArray(value)) {
|
|
147
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
148
|
+
if (Object.getOwnPropertySymbols(value).length || Object.keys(descriptors).length !== value.length + 1)
|
|
149
|
+
throw new Error('Execution arrays contain non-JSON properties');
|
|
150
|
+
for (let i = 0; i < value.length; i++) {
|
|
151
|
+
const descriptor = descriptors[String(i)];
|
|
152
|
+
if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value'))
|
|
153
|
+
throw new Error('Sparse or accessor execution arrays are ambiguous');
|
|
154
|
+
jsonShape(descriptor.value, depth + 1, budget);
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (value && typeof value === 'object' && [Object.prototype, null].includes(Object.getPrototypeOf(value))) {
|
|
159
|
+
if (Object.getOwnPropertySymbols(value).length)
|
|
160
|
+
throw new Error('Execution body contains non-JSON keys');
|
|
161
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
|
|
162
|
+
unicode(key);
|
|
163
|
+
if (!descriptor.enumerable || !Object.hasOwn(descriptor, 'value'))
|
|
164
|
+
throw new Error('Execution body contains non-JSON properties');
|
|
165
|
+
jsonShape(descriptor.value, depth + 1, budget);
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
throw new Error('Execution body must contain only safe JSON values');
|
|
170
|
+
}
|
|
171
|
+
function unicode(value) {
|
|
172
|
+
for (let i = 0; i < value.length; i++) {
|
|
173
|
+
const code = value.charCodeAt(i);
|
|
174
|
+
if (code >= 0xd800 && code <= 0xdbff) {
|
|
175
|
+
const next = value.charCodeAt(++i);
|
|
176
|
+
if (!(next >= 0xdc00 && next <= 0xdfff))
|
|
177
|
+
throw new Error('Execution JSON contains an unpaired Unicode surrogate');
|
|
178
|
+
}
|
|
179
|
+
else if (code >= 0xdc00 && code <= 0xdfff)
|
|
180
|
+
throw new Error('Execution JSON contains an unpaired Unicode surrogate');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// The structural half of executionBodyHash (the byte bound needs the encoding and stays there).
|
|
184
|
+
function bodyShape(body) {
|
|
185
|
+
if (!body || typeof body !== 'object' || Array.isArray(body) || Object.hasOwn(body, 'execution_authorization'))
|
|
186
|
+
throw new Error('Execution body must be an unsigned JSON object');
|
|
187
|
+
jsonShape(body, 0, { remaining: 65_536 });
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Hash the complete unsigned body with the existing RFC8785 encoder and Rust bounds.
|
|
191
|
+
* Explicit null and absent fields remain distinct; no operation field is dropped.
|
|
192
|
+
* @param body Complete unsigned JSON object, excluding only its approval envelope.
|
|
193
|
+
*/
|
|
194
|
+
export function executionBodyHash(body) {
|
|
195
|
+
bodyShape(body);
|
|
196
|
+
const encoded = JSON.stringify(body);
|
|
197
|
+
if (new TextEncoder().encode(encoded).length > MAX_EXECUTION_BODY_BYTES)
|
|
198
|
+
throw new Error('Execution body exceeds serialized byte bound');
|
|
199
|
+
return keccak256(toHex(canonicalize(encoded)));
|
|
200
|
+
}
|
|
201
|
+
async function paymentConsent(payment, policy) {
|
|
202
|
+
assertPaymentIntentWire(payment);
|
|
203
|
+
integer(policy.nowSecs);
|
|
204
|
+
integer(policy.chainId);
|
|
205
|
+
protocolHex(policy.settlement, 20, 'execution Settlement');
|
|
206
|
+
protocolHex(policy.keyRegistry, 20, 'execution KeyRegistry');
|
|
207
|
+
protocolHex(policy.creator, 20, 'execution creator');
|
|
208
|
+
protocolHex(policy.paymentHash, 32, 'expected payment hash');
|
|
209
|
+
if (policy.chainId === 0 || /^0x0{40}$/i.test(policy.creator) || /^0x0{40}$/i.test(policy.settlement) || /^0x0{40}$/i.test(policy.keyRegistry)
|
|
210
|
+
|| payment.chain_id !== policy.chainId || payment.settlement.toLowerCase() !== policy.settlement.toLowerCase()
|
|
211
|
+
|| payment.key_registry.toLowerCase() !== policy.keyRegistry.toLowerCase() || paymentIntentHash(payment).toLowerCase() !== policy.paymentHash.toLowerCase()
|
|
212
|
+
|| payment.expires <= policy.nowSecs || payment.expires - policy.nowSecs > 3600 || policy.cost <= 0n || policy.cost > BigInt(payment.max_cost)
|
|
213
|
+
|| [payment.session_commitment, payment.nonce, payment.verification_seed].some(value => /^0x0{64}$/i.test(value)))
|
|
214
|
+
throw new Error('Execution payment differs from independent consent policy');
|
|
215
|
+
const creator = await recoverTypedDataSigner(paymentIntentTypedData(payment), payment.signature);
|
|
216
|
+
if (creator.toLowerCase() !== policy.creator.toLowerCase())
|
|
217
|
+
throw new Error('Execution payment is not signed by the slot creator');
|
|
218
|
+
}
|
|
219
|
+
async function certified(payment, certificate, policy) {
|
|
220
|
+
if (certificate.expires <= policy.nowSecs)
|
|
221
|
+
throw new Error('Execution certificate expired');
|
|
222
|
+
protocolHex(certificate.creator_signature, 65, 'execution creator signature');
|
|
223
|
+
const creator = await recoverTypedDataSigner(executionCertificateTypedData(payment, certificate), certificate.creator_signature);
|
|
224
|
+
if (creator.toLowerCase() !== policy.creator.toLowerCase())
|
|
225
|
+
throw new Error('Execution key is not certified by the slot creator');
|
|
226
|
+
}
|
|
227
|
+
function keeperTarget(payment, stage, operator) {
|
|
228
|
+
if (stage !== 'coordinator' && stage !== 'contributor')
|
|
229
|
+
return;
|
|
230
|
+
const coordinator = toHex(Uint8Array.from(payment.keeper_assignment.coordinator));
|
|
231
|
+
const contributors = payment.keeper_assignment.contributors.map(key => toHex(Uint8Array.from(key)));
|
|
232
|
+
if (payment.action === 'dual-approve' || (stage === 'coordinator' ? coordinator !== operator.toLowerCase() : !contributors.includes(operator.toLowerCase())))
|
|
233
|
+
throw new Error('Execution approval targets an unassigned keeper stage');
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Sign and verify a creator certificate without handing a private execution key to the agent.
|
|
237
|
+
* @param options Independent consent policy, original payment, public execution key and creator wallet.
|
|
238
|
+
*/
|
|
239
|
+
export async function createExecutionCertificate(options) {
|
|
240
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy }, creator = options.creator;
|
|
241
|
+
const certificate = { execution_key: toHex(options.publicKey.slice()), expires: options.expires, creator_signature: '0x' };
|
|
242
|
+
const typedData = executionCertificateTypedData(payment, certificate);
|
|
243
|
+
await paymentConsent(payment, policy);
|
|
244
|
+
if (creator.address.toLowerCase() !== policy.creator.toLowerCase() || certificate.expires <= policy.nowSecs)
|
|
245
|
+
throw new Error('Execution certificate requires the current creator and live expiry');
|
|
246
|
+
certificate.creator_signature = await creator.signTypedData(typedData);
|
|
247
|
+
await certified(payment, certificate, policy);
|
|
248
|
+
return certificate;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Verify creator consent, stage/operator/body binding and the strict local client signature.
|
|
252
|
+
* The caller must independently authenticate the operator assignment and fresh payment backing.
|
|
253
|
+
* @param options Original payment, independently selected policy/target and untrusted proof.
|
|
254
|
+
*/
|
|
255
|
+
export async function verifyExecutionAuthorization(options) {
|
|
256
|
+
exactObject(options.authorization, ['certificate', 'stage', 'operator_key', 'body_hash', 'expires', 'signature']);
|
|
257
|
+
certificateShape(options.authorization.certificate);
|
|
258
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy };
|
|
259
|
+
const { expected, bodyHash } = expectedSnapshot(options.expected), proof = structuredClone(options.authorization);
|
|
260
|
+
await paymentConsent(payment, policy);
|
|
261
|
+
await certified(payment, proof.certificate, policy);
|
|
262
|
+
if (proof.stage !== expected.stage || proof.operator_key.toLowerCase() !== expected.operatorKey.toLowerCase()
|
|
263
|
+
|| proof.expires <= policy.nowSecs || proof.body_hash.toLowerCase() !== bodyHash.toLowerCase())
|
|
264
|
+
throw new Error('Execution approval differs from the intended live stage and body');
|
|
265
|
+
keeperTarget(payment, proof.stage, proof.operator_key);
|
|
266
|
+
const hash = protocolHex(hashTypedData(executionApprovalTypedData(payment, proof)), 32, 'execution approval hash');
|
|
267
|
+
if (!strictSignature(protocolHex(proof.signature, 64, 'execution signature'), hash, strongKey(proof.certificate.execution_key)))
|
|
268
|
+
throw new Error('Invalid client execution signature');
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Reconstruct the durable binding shared with the worker and accountant journals.
|
|
272
|
+
* This is a commitment helper, not permission to execute or evidence of correct computation.
|
|
273
|
+
* @param payment Original locally retained payment.
|
|
274
|
+
* @param consent Public original consent; never includes the private request preimage.
|
|
275
|
+
* @param reservationBlock Canonical block hash at the worker's original admission.
|
|
276
|
+
*/
|
|
277
|
+
export function executionConsentBinding(payment, consent, reservationBlock) {
|
|
278
|
+
exactObject(consent, ['authorization', 'inputs_commitment', 'verified_at']);
|
|
279
|
+
exactObject(consent.authorization, ['certificate', 'stage', 'operator_key', 'body_hash', 'expires', 'signature']);
|
|
280
|
+
certificateShape(consent.authorization.certificate);
|
|
281
|
+
integer(consent.verified_at);
|
|
282
|
+
const inputs = consent.inputs_commitment;
|
|
283
|
+
jsonShape(inputs, 0, { remaining: 64 });
|
|
284
|
+
// Array.from alone would silently truncate malformed or out-of-range wire bytes.
|
|
285
|
+
if (!Array.isArray(inputs) || inputs.length !== 32 || inputs.some(n => !Number.isInteger(n) || n < 0 || n > 255)
|
|
286
|
+
|| Object.keys(inputs).length !== 32 || inputs.every(n => n === 0) || consent.verified_at === 0)
|
|
287
|
+
throw new Error('Invalid durable execution consent');
|
|
288
|
+
const block = protocolHex(reservationBlock, 32, 'execution reservation block');
|
|
289
|
+
if (block.every(n => n === 0))
|
|
290
|
+
throw new Error('Missing execution reservation block');
|
|
291
|
+
const clock = new Uint8Array(8);
|
|
292
|
+
new DataView(clock.buffer).setBigUint64(0, BigInt(consent.verified_at));
|
|
293
|
+
const approval = protocolHex(hashTypedData(executionApprovalTypedData(payment, consent.authorization)), 32, 'execution approval hash');
|
|
294
|
+
return keccak256(toHex(new Uint8Array([...new TextEncoder().encode('keykeeper/client-approved-execution-binding/v1'),
|
|
295
|
+
...approval, ...inputs, ...clock, ...block])));
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Verify public financial consent at its original admission time. The caller must first
|
|
299
|
+
* authenticate the historical creator, reserved cost, canonical block and operator assignment.
|
|
300
|
+
* Work admission must continue to use verifyExecutionAuthorization with the complete body.
|
|
301
|
+
* @param options Independently established history and worker binding, plus untrusted consent.
|
|
302
|
+
*/
|
|
303
|
+
export async function verifyExecutionConsent(options) {
|
|
304
|
+
const binding = executionConsentBinding(options.payment, options.consent, options.expected.reservationBlock);
|
|
305
|
+
const payment = structuredClone(options.payment), consent = structuredClone(options.consent);
|
|
306
|
+
const policy = { ...options.policy }, expected = { ...options.expected }, proof = consent.authorization;
|
|
307
|
+
stage(expected.stage);
|
|
308
|
+
strongKey(expected.operatorKey);
|
|
309
|
+
protocolHex(expected.executionBinding, 32, 'expected execution binding');
|
|
310
|
+
if (policy.nowSecs !== consent.verified_at || binding.toLowerCase() !== expected.executionBinding.toLowerCase()
|
|
311
|
+
|| proof.stage !== expected.stage || proof.operator_key.toLowerCase() !== expected.operatorKey.toLowerCase()
|
|
312
|
+
|| proof.expires <= policy.nowSecs)
|
|
313
|
+
throw new Error('Original client consent differs from execution evidence');
|
|
314
|
+
await paymentConsent(payment, policy);
|
|
315
|
+
await certified(payment, proof.certificate, policy);
|
|
316
|
+
keeperTarget(payment, proof.stage, proof.operator_key);
|
|
317
|
+
const hash = protocolHex(hashTypedData(executionApprovalTypedData(payment, proof)), 32, 'execution approval hash');
|
|
318
|
+
if (!strictSignature(protocolHex(proof.signature, 64, 'execution signature'), hash, strongKey(proof.certificate.execution_key)))
|
|
319
|
+
throw new Error('Invalid original client execution signature');
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Approve a complete proposal ONLY after comparing it with a separately client-built body.
|
|
323
|
+
* Applications must construct expected.body from their own intent and validated presentation,
|
|
324
|
+
* never echo an agent's proposal into that field. This helper performs no automatic HTTP dispatch.
|
|
325
|
+
* @param options Original consent, certified local signer, independent expected body and untrusted proposal.
|
|
326
|
+
*/
|
|
327
|
+
export async function approveExecutionRequest(options) {
|
|
328
|
+
certificateShape(options.certificate);
|
|
329
|
+
exactObject(options.proposal, ['stage', 'operator_key', 'unsigned_body', 'expires']);
|
|
330
|
+
bodyShape(options.proposal.unsigned_body);
|
|
331
|
+
const payment = structuredClone(options.payment), certificate = structuredClone(options.certificate), policy = { ...options.policy };
|
|
332
|
+
const { expected, bodyHash } = expectedSnapshot(options.expected), proposal = structuredClone(options.proposal), signer = options.signer;
|
|
333
|
+
const publicKey = signer.publicKey.slice();
|
|
334
|
+
if (proposal.stage !== expected.stage || proposal.operator_key.toLowerCase() !== expected.operatorKey.toLowerCase()
|
|
335
|
+
|| executionBodyHash(proposal.unsigned_body) !== bodyHash)
|
|
336
|
+
throw new Error('Agent execution proposal differs from the client-built intent');
|
|
337
|
+
if (!equalBytes(publicKey, strongKey(certificate.execution_key)))
|
|
338
|
+
throw new Error('Local execution signer differs from creator certificate');
|
|
339
|
+
keeperTarget(payment, expected.stage, expected.operatorKey);
|
|
340
|
+
await paymentConsent(payment, policy);
|
|
341
|
+
await certified(payment, certificate, policy);
|
|
342
|
+
const approval = { certificate, stage: expected.stage, operator_key: expected.operatorKey,
|
|
343
|
+
body_hash: bodyHash, expires: proposal.expires, signature: '0x' };
|
|
344
|
+
if (approval.expires <= policy.nowSecs)
|
|
345
|
+
throw new Error('Execution approval expired');
|
|
346
|
+
const hash = hashTypedData(executionApprovalTypedData(payment, approval));
|
|
347
|
+
approval.signature = toHex(await signer.sign(protocolHex(hash, 32, 'execution approval hash')));
|
|
348
|
+
await verifyExecutionAuthorization({ payment, policy, expected, authorization: approval });
|
|
349
|
+
return approval;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Reconstruct session initialization typed data from the original payment and client-built commitments.
|
|
353
|
+
* @param payment Original locally retained creator payment.
|
|
354
|
+
* @param initialization Certificate, approved profile hash, complete create-body hash and expiry.
|
|
355
|
+
*/
|
|
356
|
+
export function executionInitializationTypedData(payment, initialization) {
|
|
357
|
+
integer(initialization.expires);
|
|
358
|
+
protocolHex(initialization.profile_hash, 32, 'approved agent profile hash');
|
|
359
|
+
protocolHex(initialization.body_hash, 32, 'session creation body hash');
|
|
360
|
+
if (initialization.expires === 0 || initialization.expires > initialization.certificate.expires
|
|
361
|
+
|| [initialization.profile_hash, initialization.body_hash].some(hash => /^0x0{64}$/i.test(hash)))
|
|
362
|
+
throw new Error('Invalid session initialization expiry or commitment');
|
|
363
|
+
return { domain: { name: EXECUTION_INITIALIZATION_DOMAIN, version: '1', chainId: payment.chain_id, verifyingContract: payment.settlement },
|
|
364
|
+
primaryType: 'ClientSessionInitialization', types: INITIALIZATION_TYPES,
|
|
365
|
+
message: { ...common(payment), certificateHash: hashTypedData(executionCertificateTypedData(payment, initialization.certificate)),
|
|
366
|
+
profileHash: initialization.profile_hash, bodyHash: initialization.body_hash, expires: BigInt(initialization.expires) } };
|
|
367
|
+
}
|
|
368
|
+
function initializationSnapshot(expected) {
|
|
369
|
+
exactObject(expected, ['serviceProfile', 'body']);
|
|
370
|
+
if (Object.hasOwn(expected.body, 'execution_initialization'))
|
|
371
|
+
throw new Error('Session body must exclude its initialization envelope');
|
|
372
|
+
executionBodyHash(expected.serviceProfile);
|
|
373
|
+
executionBodyHash(expected.body);
|
|
374
|
+
return structuredClone(expected);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Verify fresh client consent before creating or retrying a registered agent session.
|
|
378
|
+
* @param options Independently selected profile/body/policy, original payment and untrusted proof.
|
|
379
|
+
*/
|
|
380
|
+
export async function verifySessionInitialization(options) {
|
|
381
|
+
exactObject(options.initialization, ['certificate', 'profile_hash', 'body_hash', 'expires', 'signature']);
|
|
382
|
+
certificateShape(options.initialization.certificate);
|
|
383
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy };
|
|
384
|
+
const expected = initializationSnapshot(options.expected), proof = structuredClone(options.initialization);
|
|
385
|
+
await paymentConsent(payment, policy);
|
|
386
|
+
await certified(payment, proof.certificate, policy);
|
|
387
|
+
if (proof.expires <= policy.nowSecs)
|
|
388
|
+
throw new Error('Session initialization expired');
|
|
389
|
+
if (proof.profile_hash.toLowerCase() !== executionBodyHash(expected.serviceProfile)
|
|
390
|
+
|| proof.body_hash.toLowerCase() !== executionBodyHash(expected.body))
|
|
391
|
+
throw new Error('Session initialization differs from the approved agent and client body');
|
|
392
|
+
const hash = protocolHex(hashTypedData(executionInitializationTypedData(payment, proof)), 32, 'session initialization hash');
|
|
393
|
+
if (!strictSignature(protocolHex(proof.signature, 64, 'session initialization signature'), hash, strongKey(proof.certificate.execution_key)))
|
|
394
|
+
throw new Error('Invalid client session initialization signature');
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Authorize one client-built creation body, including a locally generated owner bearer.
|
|
398
|
+
* Retain the body, proof and signer privately until expiry: retrying the identical POST uses
|
|
399
|
+
* the hash of these typed data as its session ID and cannot replace the original ECDH key.
|
|
400
|
+
* This function neither reserves funds nor starts or pays an operator.
|
|
401
|
+
* @param options Original payment, certified client signer and independently approved create intent.
|
|
402
|
+
*/
|
|
403
|
+
export async function initializeExecutionSession(options) {
|
|
404
|
+
certificateShape(options.certificate);
|
|
405
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy }, certificate = structuredClone(options.certificate);
|
|
406
|
+
const expected = initializationSnapshot(options.expected), signer = options.signer, publicKey = signer.publicKey.slice(), expires = options.expires;
|
|
407
|
+
if (!equalBytes(publicKey, strongKey(certificate.execution_key)))
|
|
408
|
+
throw new Error('Local execution signer differs from creator certificate');
|
|
409
|
+
await paymentConsent(payment, policy);
|
|
410
|
+
await certified(payment, certificate, policy);
|
|
411
|
+
const proof = { certificate, profile_hash: executionBodyHash(expected.serviceProfile),
|
|
412
|
+
body_hash: executionBodyHash(expected.body), expires, signature: '0x' };
|
|
413
|
+
if (proof.expires <= policy.nowSecs)
|
|
414
|
+
throw new Error('Session initialization expired');
|
|
415
|
+
const hash = hashTypedData(executionInitializationTypedData(payment, proof));
|
|
416
|
+
proof.signature = toHex(await signer.sign(protocolHex(hash, 32, 'session initialization hash')));
|
|
417
|
+
await verifySessionInitialization({ payment, policy, expected, initialization: proof });
|
|
418
|
+
return proof;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Create a disposable client-only Ed25519 execution signer. The seed is copied or generated
|
|
422
|
+
* with Web Crypto, retained only locally and erased by dispose; caller copies remain its responsibility.
|
|
423
|
+
* The copy never shares memory with the caller's bytes (a Node `Buffer` or any view of a larger
|
|
424
|
+
* buffer included), so the caller may wipe its seed at once and dispose never touches it.
|
|
425
|
+
* @param seed Optional local 32-byte seed, for private persistence or deterministic tests.
|
|
426
|
+
*/
|
|
427
|
+
export function createLocalExecutionSigner(seed) {
|
|
428
|
+
// Uint8Array.from, never seed.slice(): Buffer#slice is a VIEW, so the caller wiping its seed
|
|
429
|
+
// would zero this signer's secret while its publicKey still names the original key.
|
|
430
|
+
if (seed !== undefined && !(seed instanceof Uint8Array))
|
|
431
|
+
throw new Error('Execution seed must contain 32 bytes');
|
|
432
|
+
const secret = seed === undefined ? globalThis.crypto.getRandomValues(new Uint8Array(32)) : Uint8Array.from(seed);
|
|
433
|
+
if (secret.length !== 32) {
|
|
434
|
+
secret.fill(0);
|
|
435
|
+
throw new Error('Execution seed must contain 32 bytes');
|
|
436
|
+
}
|
|
437
|
+
const publicKey = ed25519.getPublicKey(secret);
|
|
438
|
+
let disposed = false;
|
|
439
|
+
return { get publicKey() { return publicKey.slice(); }, async sign(message) {
|
|
440
|
+
if (disposed)
|
|
441
|
+
throw new Error('Local execution signer was disposed');
|
|
442
|
+
if (message.length !== 32)
|
|
443
|
+
throw new Error('Execution signer accepts only reconstructed 32-byte hashes');
|
|
444
|
+
return ed25519.sign(Uint8Array.from(message), secret);
|
|
445
|
+
}, dispose() { secret.fill(0); disposed = true; } };
|
|
446
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { recipientPayloadDigest } from '../crypto/recipient.js';
|
|
1
2
|
import { equalBytes } from '@noble/curves/utils.js';
|
|
2
3
|
import { utf8ToBytes } from '@noble/hashes/utils';
|
|
3
4
|
import { sha256 } from '@noble/hashes/sha256';
|
|
4
|
-
import {
|
|
5
|
+
import { combineVerifiedIbeShares, ibeDecryptWithKey, ibeIdentityPoint, ibeVerifyShareAt } from '../crypto/ibe.js';
|
|
5
6
|
import { TasraError, ThresholdNotMetError } from '../errors.js';
|
|
6
|
-
import {
|
|
7
|
+
import { collectIbeExtractionPartials } from './client.js';
|
|
7
8
|
import { compoundTokenHash, decodeCompoundToken } from './token.js';
|
|
8
9
|
import { auditOperationId, protocolHex, verifyOperationReceipt } from './receipts.js';
|
|
9
10
|
/**
|
|
@@ -39,36 +40,42 @@ export async function extractIdentityStrict(input) {
|
|
|
39
40
|
const byUrl = new Map(keepers.map(k => [k.nodeUrl, k]));
|
|
40
41
|
const threshold = input.threshold, epoch = input.epoch, shareTrust = input.shareTrust, required = input.requireReceipts;
|
|
41
42
|
const tokenHash = compoundTokenHash(decodeCompoundToken(input.committeeToken));
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
if (!input.recipient)
|
|
44
|
+
throw new TasraError('Client recipient required for sealed extraction');
|
|
45
|
+
const opId = auditOperationId(slot, 'ibe-extract', tokenHash, recipientPayloadDigest(sha256(identity), epoch, input.recipient.recipient));
|
|
46
|
+
const evidence = [];
|
|
47
|
+
// Q_ID once per operation, for every share check and the group-key check.
|
|
48
|
+
const qId = ibeIdentityPoint(identity);
|
|
49
|
+
const partials = await collectIbeExtractionPartials({ ...input, nodeUrls: keepers.map(k => k.nodeUrl), ciphertextEpoch: epoch }, p => {
|
|
50
|
+
const k = byUrl.get(p.nodeUrl);
|
|
51
|
+
if (!k || !Number.isSafeInteger(p.identifier) || p.identifier < 1 || p.identifier > 65535 ||
|
|
52
|
+
p.epoch !== epoch || !equalBytes(protocolHex(p.keySlotId, 32, 'extraction slot'), slot) || p.value.length !== 48 || p.verifyingShareG2.length !== 96 ||
|
|
53
|
+
k.identifier !== undefined && k.identifier !== p.identifier || k.verifyingShareG2 && !equalBytes(k.verifyingShareG2, p.verifyingShareG2)) {
|
|
54
|
+
throw new TasraError('Extraction share has inconsistent slot, epoch, keeper or key provenance');
|
|
55
|
+
}
|
|
56
|
+
let receiptStatus = p.receipt ? 'unverified' : 'absent';
|
|
57
|
+
if (p.receipt && k.publicKey) {
|
|
58
|
+
if (!verifyOperationReceipt(p.receipt, { chainId: input.chainId, slotId: slot, tokenHash, opId, keeperPublicKey: k.publicKey })) {
|
|
59
|
+
throw new TasraError('Invalid extraction operation receipt');
|
|
60
|
+
}
|
|
61
|
+
receiptStatus = 'verified';
|
|
62
|
+
}
|
|
63
|
+
if (required && receiptStatus !== 'verified')
|
|
64
|
+
throw new TasraError('Verified extraction receipt required');
|
|
65
|
+
// A received reply only counts after provenance, receipt and pairing verification.
|
|
66
|
+
ibeVerifyShareAt(k.verifyingShareG2 ?? p.verifyingShareG2, qId, p);
|
|
67
|
+
evidence.push({ operator: k.operator, identifier: p.identifier, nodeUrl: p.nodeUrl, ...(p.receipt ? { receipt: p.receipt } : {}), receiptStatus });
|
|
68
|
+
});
|
|
44
69
|
let key;
|
|
45
70
|
try {
|
|
46
71
|
input.signal?.throwIfAborted();
|
|
47
72
|
if (partials.length < threshold)
|
|
48
73
|
throw new ThresholdNotMetError({ got: partials.length, need: threshold });
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (!k || !Number.isSafeInteger(p.identifier) || p.identifier < 1 || p.identifier > 65535 || ids.has(p.identifier) ||
|
|
53
|
-
p.epoch !== epoch || !equalBytes(protocolHex(p.keySlotId, 32, 'extraction slot'), slot) || p.value.length !== 48 || p.verifyingShareG2.length !== 96 ||
|
|
54
|
-
k.identifier !== undefined && k.identifier !== p.identifier || k.verifyingShareG2 && !equalBytes(k.verifyingShareG2, p.verifyingShareG2)) {
|
|
55
|
-
throw new TasraError('Extraction share has inconsistent slot, epoch, keeper or key provenance');
|
|
56
|
-
}
|
|
57
|
-
ids.add(p.identifier);
|
|
58
|
-
let receiptStatus = p.receipt ? 'unverified' : 'absent';
|
|
59
|
-
if (p.receipt && k.publicKey) {
|
|
60
|
-
if (!verifyOperationReceipt(p.receipt, { chainId: input.chainId, slotId: slot, tokenHash, opId, keeperPublicKey: k.publicKey })) {
|
|
61
|
-
throw new TasraError('Invalid extraction operation receipt');
|
|
62
|
-
}
|
|
63
|
-
receiptStatus = 'verified';
|
|
64
|
-
}
|
|
65
|
-
if (required && receiptStatus !== 'verified')
|
|
66
|
-
throw new TasraError('Verified extraction receipt required');
|
|
67
|
-
evidence.push({ operator: k.operator, identifier: p.identifier, nodeUrl: p.nodeUrl, ...(p.receipt ? { receipt: p.receipt } : {}), receiptStatus });
|
|
68
|
-
}
|
|
69
|
-
key = ibeCombineExtract(new Map(partials.map(p => [p.identifier, p.verifyingShareG2])), partials, identity);
|
|
74
|
+
// Every partial passed the per-share pairing check above (the callback names a bad keeper);
|
|
75
|
+
// checking it again inside the combine would repeat the same equation on the same bytes.
|
|
76
|
+
key = combineVerifiedIbeShares(partials);
|
|
70
77
|
// Returned shares must combine to the slot's independently anchored master public key.
|
|
71
|
-
|
|
78
|
+
ibeVerifyShareAt(group, qId, { identifier: 1, value: key });
|
|
72
79
|
return { key, epoch, shareTrust, evidence };
|
|
73
80
|
}
|
|
74
81
|
catch (error) {
|
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
export { auditOperationId, decodeOperationReceipt, verifyOperationReceipt } from './receipts.js';
|
|
2
|
+
export { discoverBlsSharing } from './blsSharing.js';
|
|
3
|
+
export type { BlsSharing, BlsSharingOptions, BlsSharingKeeper } from './blsSharing.js';
|
|
2
4
|
export type { OperationReceipt, ReceiptExpectation } from './receipts.js';
|
|
3
5
|
export { extractIdentityStrict, decryptIdentityStrict } from './extraction.js';
|
|
4
6
|
export type { StrictExtractionOptions, StrictExtractionResult, ExtractionKeeper, ExtractionEvidence } from './extraction.js';
|
|
5
|
-
export { createDualSignClient, dualSignApprovalPayload, OperationOutcomeUnknownError } from './dual-sign.js';
|
|
7
|
+
export { createDualSignClient, dualSignApprovalPayload, paidDualSignApprovalPayload, OperationOutcomeUnknownError } from './dual-sign.js';
|
|
6
8
|
export type { DualSignConfig, DualSignApprover, DualSignRequest, DualSignStatus } from './dual-sign.js';
|
|
7
|
-
export { committeeSignEoaDigest } from './ecdsa.js';
|
|
9
|
+
export { committeeSignEoaDigest, committeeSignP256Digest } from './ecdsa.js';
|
|
10
|
+
export type { CommitteeP256SignOpts, P256DigestSignature } from './ecdsa.js';
|
|
8
11
|
export type { CommitteeEoaSignOpts } from './ecdsa.js';
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
12
|
+
export { DUAL_OPERATION_DOMAIN, DUAL_OPERATION_MAX_LIFETIME_SECS, approveDualOperation, assembleDualOperation, dualOperationFromPayload, dualOperationPayload, prepareDualOperation, requireCurrentDualOperation, requireDualOperationPayment, requireDualOperationProof, validateDualOperationStatement } from './dual-operation.js';
|
|
13
|
+
export type { DualOperationApproval, DualOperationApprovalRecord, DualOperationApprover, DualOperationKind, DualOperationProof, DualOperationStatement, PreparedDualOperation } from './dual-operation.js';
|
|
14
|
+
export { selectVerifierCommittee, compoundTokenCanonicalBytes, compoundTokenHash, opAttestationHash, clientBindingHash, verifierLeaf, verifyMerkleProof, merkleRoot, merkleProof, verifyCompoundToken, assembleCompoundToken, decodeCompoundToken, statusAttestationHash, verifyStatusAttestation, verifyStatusAttestations, requireStatusAttestations, signersThatVerify, assertStatusAttestationsWire, STATUS_ATTESTATION_DOMAIN, REVOCATION_BOUND_SECS, STATUS_SKEW_SECS, STATUS_CACHE_BOUND_SECS, MAX_STATUS_WINDOW_SECS, DEFAULT_STATUS_WINDOW_SECS, MAX_STATUS_ATTESTATIONS, STATUS_STALE_CODE, STATUS_MISSING_CODE, STATUS_INVALID_CODE, evidenceBindingMessage, verifyEvidenceBinding, } from './token.js';
|
|
15
|
+
export type { TokenType, CompoundTokenPayload, CommitteeSignature, VerifierSet, VerifiedToken, VerifyCompoundTokenOptions, CompoundTokenWire, CommitteeSignatureWire, StatusAttestation, StatusAttestationWire, VerifyStatusAttestationsOptions, RequireStatusAttestationsOptions, StatusFreshness, VerifyEvidenceBindingOptions, } from './token.js';
|
|
16
|
+
export { statusRefreshHash, statusRefreshHolderSigner, createStatusRefreshProof, statusRefreshRequestBody, statusRefreshRelayBody, parseStatusRefreshReply, classifyStatusRefreshResponse, refreshStatusDirect, refreshStatusViaAgent, acceptStatusRefreshRelay, withdrawsOriginal, STATUS_REFRESH_DOMAIN, STATUS_REFRESH_JWT_TYP, STATUS_REFRESH_PATH, MAX_STATUS_REFRESH_BODY_BYTES, STATUS_REFRESH_FRESHNESS_SECS, } from './status-refresh.js';
|
|
17
|
+
export type { StatusRefreshPrincipal, StatusRefreshHashInput, StatusRefreshHolderSigner, StatusRefreshProver, StatusRefreshProofWire, CreateStatusRefreshProofOptions, StatusRefreshReplyWire, StatusRefreshGrant, StatusRefreshResult, StatusRefreshHttpResponse, RefreshStatusDirectOptions, RefreshStatusViaAgentOptions, } from './status-refresh.js';
|
|
11
18
|
export { committeeAuthorize, gatherCommitteeToken, committeeSign, committeeDecrypt, CommitteeAuthorizeError, } from './client.js';
|
|
12
19
|
export type { CommitteeAuthorizeBody, CommitteeAuthorizeReply, GatherCommitteeTokenOpts, CommitteeSignOpts, CommitteeDecryptOpts, VerifierProof, } from './client.js';
|
|
13
|
-
export { requestCommitteeToken, committeeSignRequest, committeeDecryptRequest, buildVerifierProofs, committeeChainReadsFromClient,
|
|
14
|
-
export type { CommitteeVerifier, CommitteeChainReads, HolderProofPerVerifier, RequestCommitteeTokenOpts, CommitteeTokenResult, CommitteeSignRequestOpts, CommitteeDecryptRequestOpts,
|
|
20
|
+
export { requestCommitteeToken, committeeSignRequest, committeeDecryptRequest, buildVerifierProofs, committeeChainReadsFromClient, holderProofPerVerifier, } from './request.js';
|
|
21
|
+
export type { CommitteeVerifier, CommitteeChainReads, CommitteeDraw, HolderProofPerVerifier, RequestCommitteeTokenOpts, CommitteeTokenResult, CommitteeSignRequestOpts, CommitteeDecryptRequestOpts, } from './request.js';
|
|
15
22
|
export { requestIbeExtractionPartials } from './client.js';
|
|
16
23
|
export type { IbeExtractOpts, IbeExtractionPartial } from './client.js';
|
|
17
24
|
export { ibeExtractRequest, ibeDecryptRequest } from './request.js';
|
|
18
25
|
export type { IbeExtractRequestOpts } from './request.js';
|
|
19
|
-
export { platformAudience, dpopHtu, normalizeOrigin, isValidSessionId, OAUTH_RESPONSE_PATH_PREFIX, OAUTH_RESPONSE_PATH_SUFFIX, MAX_SESSION_ID_LEN, } from './oauth.js';
|
|
26
|
+
export { platformAudience, dpopHtu, legacyDpopHtu, normalizeOrigin, isValidSessionId, OAUTH_RESPONSE_PATH, OAUTH_RESPONSE_PATH_PREFIX, OAUTH_RESPONSE_PATH_SUFFIX, MAX_SESSION_ID_LEN, } from './oauth.js';
|
|
27
|
+
export { keeperAssignmentCommitment, paymentIntentTypedData, paymentIntentHash, prepaidRequestId, paymentSessionCommitment, assertPaymentIntentWire } from './payment.js';
|
|
28
|
+
export type { PaidKeeperAssignment, PaymentIntentWire } from './payment.js';
|
|
29
|
+
export { ALLOWANCE_ACTIONS, PREPAID_ALLOWANCE_DOMAINS, allowanceActionBits, allowanceFunds, prepaidAllowanceIntentTypedData, prepaidAllowanceIntentHash, allowanceId, allowanceReserveDigest, debitVoucherDigest, debitVoucherWireDigest, allowanceSettleDigest, allowanceCloseDigest, assertDebitVoucherWire } from './payment.js';
|
|
30
|
+
export type { AllowanceAction, PrepaidAllowanceIntentWire, DebitVoucherWire, DebitVoucherFields, AllowanceReserveArgs, AllowanceSettleArgs } from './payment.js';
|
|
31
|
+
export { EXECUTION_CERTIFICATE_DOMAIN, EXECUTION_APPROVAL_DOMAIN, EXECUTION_INITIALIZATION_DOMAIN, MAX_EXECUTION_BODY_BYTES, executionCertificateTypedData, executionApprovalTypedData, executionInitializationTypedData, initializeExecutionSession, verifySessionInitialization, executionBodyHash, createExecutionCertificate, approveExecutionRequest, verifyExecutionAuthorization, executionConsentBinding, verifyExecutionConsent, createLocalExecutionSigner } from './execution.js';
|
|
32
|
+
export type { ExecutionStage, ExecutionCertificate, ExecutionAuthorization, ExecutionConsent, ExecutionConsentPolicy, ExpectedExecution, ExecutionProposal, SessionInitialization, ExpectedInitialization, ClientExecutionSigner, LocalExecutionSigner, ExecutionCreatorSigner } from './execution.js';
|
|
33
|
+
export { paidExecutionRequest, paidExecutionReportSigningHash, verifyPaidExecutionEvidence, executionRecoverySigningHash, createExecutionRecoveryAuthorization, verifyRecoveredExecutionResult } from './recovery.js';
|
|
34
|
+
export type { PaidExecutionRequest, CompletedPaidExecutionReport, SignedPaidExecutionReport, ExecutionRecoveryAuthorization, ExecutionRecoveryTarget, RecoveredExecutionReply } from './recovery.js';
|
|
35
|
+
export type { KeeperExecutionKind, KeeperExecutionApprovalRequest, KeeperExecutionApprovals, KeeperExecutionApprover } from './keeperExecution.js';
|
|
36
|
+
export type { EvidenceBindingWire } from './evidence.js';
|
|
37
|
+
export { createDecryptionRecipient, decryptionBinding, kemContentDigest, recipientPayloadDigest } from '../crypto/recipient.js';
|
|
38
|
+
export type { ClientRecipient, RecipientWire, DecryptionBindingWire, SealedShareWire } from '../crypto/recipient.js';
|
|
39
|
+
export { collectSealedPartials, decryptWithCommitteePartials } from '../decryption/sealed.js';
|
|
40
|
+
export type { SealedRequestOpts, SealedPartial } from '../decryption/sealed.js';
|
|
41
|
+
export { SESSION_GRANT_DOMAIN, SESSION_PROOF_DOMAIN, SESSION_BATCH_PROOF_DOMAIN, SESSION_REFRESH_DOMAIN, SESSION_REVOKE_DOMAIN, MAX_SESSION_SLOTS, MAX_BATCH_ITEMS, MAX_ACCESS_TTL_SECS, DEFAULT_ACCESS_TTL_SECS, MAX_IDLE_TIMEOUT_SECS, MAX_ABSOLUTE_TTL_SECS, SESSION_PROOF_FRESHNESS_SECS, MIN_JTI_LEN, MAX_JTI_LEN, SessionGrantError, sessionGrantPayload, sessionGrantCanonicalBytes, sessionGrantHash, decodeSessionGrant, encodeSessionGrant, verifySessionGrant, parseSessionKeyJwk, sessionKeyThumbprint, checkJti, sessionProofHash, sessionBatchProofHash, sessionControlHash, verifySessionSignature, checkProofWindow, encodeSessionProof, toBase64Url } from './session-grant.js';
|
|
42
|
+
export type { GrantSlot, SessionGrantPayload, SessionGrant, GrantSlotWire, GrantSignatureWire, SessionGrantWire, SessionProofWire, VerifiedSessionGrant, VerifySessionGrantOptions, SessionKeyJwk } from './session-grant.js';
|
package/dist/committee/index.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
// compound committee authorization - token crypto + HTTP orchestration.
|
|
2
2
|
export { auditOperationId, decodeOperationReceipt, verifyOperationReceipt } from './receipts.js';
|
|
3
|
+
export { discoverBlsSharing } from './blsSharing.js';
|
|
3
4
|
export { extractIdentityStrict, decryptIdentityStrict } from './extraction.js';
|
|
4
|
-
export { createDualSignClient, dualSignApprovalPayload, OperationOutcomeUnknownError } from './dual-sign.js';
|
|
5
|
-
export { committeeSignEoaDigest } from './ecdsa.js';
|
|
6
|
-
export {
|
|
5
|
+
export { createDualSignClient, dualSignApprovalPayload, paidDualSignApprovalPayload, OperationOutcomeUnknownError } from './dual-sign.js';
|
|
6
|
+
export { committeeSignEoaDigest, committeeSignP256Digest } from './ecdsa.js';
|
|
7
|
+
export { DUAL_OPERATION_DOMAIN, DUAL_OPERATION_MAX_LIFETIME_SECS, approveDualOperation, assembleDualOperation, dualOperationFromPayload, dualOperationPayload, prepareDualOperation, requireCurrentDualOperation, requireDualOperationPayment, requireDualOperationProof, validateDualOperationStatement } from './dual-operation.js';
|
|
8
|
+
export { selectVerifierCommittee, compoundTokenCanonicalBytes, compoundTokenHash, opAttestationHash, clientBindingHash, verifierLeaf, verifyMerkleProof, merkleRoot, merkleProof, verifyCompoundToken, assembleCompoundToken, decodeCompoundToken, statusAttestationHash, verifyStatusAttestation, verifyStatusAttestations, requireStatusAttestations, signersThatVerify, assertStatusAttestationsWire, STATUS_ATTESTATION_DOMAIN, REVOCATION_BOUND_SECS, STATUS_SKEW_SECS, STATUS_CACHE_BOUND_SECS, MAX_STATUS_WINDOW_SECS, DEFAULT_STATUS_WINDOW_SECS, MAX_STATUS_ATTESTATIONS, STATUS_STALE_CODE, STATUS_MISSING_CODE, STATUS_INVALID_CODE, evidenceBindingMessage, verifyEvidenceBinding, } from './token.js';
|
|
9
|
+
export { statusRefreshHash, statusRefreshHolderSigner, createStatusRefreshProof, statusRefreshRequestBody, statusRefreshRelayBody, parseStatusRefreshReply, classifyStatusRefreshResponse, refreshStatusDirect, refreshStatusViaAgent, acceptStatusRefreshRelay, withdrawsOriginal, STATUS_REFRESH_DOMAIN, STATUS_REFRESH_JWT_TYP, STATUS_REFRESH_PATH, MAX_STATUS_REFRESH_BODY_BYTES, STATUS_REFRESH_FRESHNESS_SECS, } from './status-refresh.js';
|
|
7
10
|
export { committeeAuthorize, gatherCommitteeToken, committeeSign, committeeDecrypt, CommitteeAuthorizeError, } from './client.js';
|
|
8
|
-
export { requestCommitteeToken, committeeSignRequest, committeeDecryptRequest, buildVerifierProofs, committeeChainReadsFromClient,
|
|
11
|
+
export { requestCommitteeToken, committeeSignRequest, committeeDecryptRequest, buildVerifierProofs, committeeChainReadsFromClient, holderProofPerVerifier, } from './request.js';
|
|
9
12
|
// identity-key extraction
|
|
10
13
|
export { requestIbeExtractionPartials } from './client.js';
|
|
11
14
|
export { ibeExtractRequest, ibeDecryptRequest } from './request.js';
|
|
12
|
-
//
|
|
13
|
-
export { platformAudience, dpopHtu, normalizeOrigin, isValidSessionId, OAUTH_RESPONSE_PATH_PREFIX, OAUTH_RESPONSE_PATH_SUFFIX, MAX_SESSION_ID_LEN, } from './oauth.js';
|
|
15
|
+
// derived OAuth audience + DPoP htu
|
|
16
|
+
export { platformAudience, dpopHtu, legacyDpopHtu, normalizeOrigin, isValidSessionId, OAUTH_RESPONSE_PATH, OAUTH_RESPONSE_PATH_PREFIX, OAUTH_RESPONSE_PATH_SUFFIX, MAX_SESSION_ID_LEN, } from './oauth.js';
|
|
17
|
+
export { keeperAssignmentCommitment, paymentIntentTypedData, paymentIntentHash, prepaidRequestId, paymentSessionCommitment, assertPaymentIntentWire } from './payment.js';
|
|
18
|
+
// ADR-0090 prepaid allowances and debit vouchers (the shared Encodings table).
|
|
19
|
+
export { ALLOWANCE_ACTIONS, PREPAID_ALLOWANCE_DOMAINS, allowanceActionBits, allowanceFunds, prepaidAllowanceIntentTypedData, prepaidAllowanceIntentHash, allowanceId, allowanceReserveDigest, debitVoucherDigest, debitVoucherWireDigest, allowanceSettleDigest, allowanceCloseDigest, assertDebitVoucherWire } from './payment.js';
|
|
20
|
+
export { EXECUTION_CERTIFICATE_DOMAIN, EXECUTION_APPROVAL_DOMAIN, EXECUTION_INITIALIZATION_DOMAIN, MAX_EXECUTION_BODY_BYTES, executionCertificateTypedData, executionApprovalTypedData, executionInitializationTypedData, initializeExecutionSession, verifySessionInitialization, executionBodyHash, createExecutionCertificate, approveExecutionRequest, verifyExecutionAuthorization, executionConsentBinding, verifyExecutionConsent, createLocalExecutionSigner } from './execution.js';
|
|
21
|
+
export { paidExecutionRequest, paidExecutionReportSigningHash, verifyPaidExecutionEvidence, executionRecoverySigningHash, createExecutionRecoveryAuthorization, verifyRecoveredExecutionResult } from './recovery.js';
|
|
22
|
+
export { createDecryptionRecipient, decryptionBinding, kemContentDigest, recipientPayloadDigest } from '../crypto/recipient.js';
|
|
23
|
+
export { collectSealedPartials, decryptWithCommitteePartials } from '../decryption/sealed.js';
|
|
24
|
+
// ADR-0090 D7 session grants: shared format with the reference `keykeeper_committee::session_grant`.
|
|
25
|
+
export { SESSION_GRANT_DOMAIN, SESSION_PROOF_DOMAIN, SESSION_BATCH_PROOF_DOMAIN, SESSION_REFRESH_DOMAIN, SESSION_REVOKE_DOMAIN, MAX_SESSION_SLOTS, MAX_BATCH_ITEMS, MAX_ACCESS_TTL_SECS, DEFAULT_ACCESS_TTL_SECS, MAX_IDLE_TIMEOUT_SECS, MAX_ABSOLUTE_TTL_SECS, SESSION_PROOF_FRESHNESS_SECS, MIN_JTI_LEN, MAX_JTI_LEN, SessionGrantError, sessionGrantPayload, sessionGrantCanonicalBytes, sessionGrantHash, decodeSessionGrant, encodeSessionGrant, verifySessionGrant, parseSessionKeyJwk, sessionKeyThumbprint, checkJti, sessionProofHash, sessionBatchProofHash, sessionControlHash, verifySessionSignature, checkProofWindow, encodeSessionProof, toBase64Url } from './session-grant.js';
|