@t3foundry/tasra-sdk 0.3.1-next.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,204 @@
|
|
|
1
|
+
import { base64Decode } from '../crypto/envelope.js';
|
|
2
|
+
import { ed25519 } from '@noble/curves/ed25519';
|
|
3
|
+
import { equalBytes } from '@noble/curves/utils.js';
|
|
4
|
+
import { sha256 } from '@noble/hashes/sha256';
|
|
5
|
+
import { keccak256, toHex } from 'viem';
|
|
6
|
+
import { assertPaymentIntentWire, paymentIntentHash, prepaidRequestId } from './payment.js';
|
|
7
|
+
import { executionConsentBinding, MAX_EXECUTION_BODY_BYTES, verifyExecutionConsent } from './execution.js';
|
|
8
|
+
import { protocolHex } from './receipts.js';
|
|
9
|
+
import { parseExecutionJson } from './recoveryJson.js';
|
|
10
|
+
const STAGES = { coordinator: 0, contributor: 1, presentation_sign: 2, presentation_attest: 3, credential: 4 };
|
|
11
|
+
const ACTIONS = { sign: 0, decrypt: 1, 'eoa-sign': 2, 'ibe-extract': 3, 'dual-approve': 6 };
|
|
12
|
+
function exact(value, fields) {
|
|
13
|
+
if (!value || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
14
|
+
throw new Error('Invalid execution evidence object');
|
|
15
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
16
|
+
if (Object.getOwnPropertySymbols(value).length || Object.keys(descriptors).length !== fields.length
|
|
17
|
+
|| fields.some(field => !Object.hasOwn(descriptors, field))
|
|
18
|
+
|| Object.values(descriptors).some(d => !d.enumerable || !Object.hasOwn(d, 'value')))
|
|
19
|
+
throw new Error('Execution evidence has missing or unknown fields');
|
|
20
|
+
}
|
|
21
|
+
function bytes32(value) {
|
|
22
|
+
if (!Array.isArray(value) || value.length !== 32 || Object.keys(value).length !== 32
|
|
23
|
+
|| Object.getOwnPropertySymbols(value).length
|
|
24
|
+
|| Object.values(Object.getOwnPropertyDescriptors(value)).some(d => !Object.hasOwn(d, 'value'))
|
|
25
|
+
|| value.some(n => !Number.isInteger(n) || n < 0 || n > 255))
|
|
26
|
+
throw new Error('Execution evidence requires 32 unsigned bytes');
|
|
27
|
+
for (let i = 0; i < 32; i++)
|
|
28
|
+
if (!Object.hasOwn(value, i))
|
|
29
|
+
throw new Error('Execution evidence requires a dense byte array');
|
|
30
|
+
return Uint8Array.from(value);
|
|
31
|
+
}
|
|
32
|
+
function nonzero(bytes) {
|
|
33
|
+
if (bytes.every(n => n === 0))
|
|
34
|
+
throw new Error('Missing execution evidence commitment');
|
|
35
|
+
return bytes;
|
|
36
|
+
}
|
|
37
|
+
function ordinal(stage) {
|
|
38
|
+
if (!Object.hasOwn(STAGES, stage))
|
|
39
|
+
throw new Error('Unknown execution stage');
|
|
40
|
+
return STAGES[stage];
|
|
41
|
+
}
|
|
42
|
+
function uint64(value) {
|
|
43
|
+
if (!Number.isSafeInteger(value) || value <= 0)
|
|
44
|
+
throw new Error('Invalid execution recovery clock');
|
|
45
|
+
const bytes = new Uint8Array(8);
|
|
46
|
+
new DataView(bytes.buffer).setBigUint64(0, BigInt(value));
|
|
47
|
+
return bytes;
|
|
48
|
+
}
|
|
49
|
+
function primeKey(hex) {
|
|
50
|
+
const key = protocolHex(hex, 32, 'execution recovery key'), point = ed25519.Point.fromHex(key, false);
|
|
51
|
+
if (point.isSmallOrder() || !point.isTorsionFree())
|
|
52
|
+
throw new Error('Invalid execution recovery public key');
|
|
53
|
+
return key;
|
|
54
|
+
}
|
|
55
|
+
function packed(domain, ...parts) {
|
|
56
|
+
return keccak256(toHex(new Uint8Array([...new TextEncoder().encode(domain), ...parts.flatMap(p => [...p])])));
|
|
57
|
+
}
|
|
58
|
+
function matchesRequest(payment, request) {
|
|
59
|
+
assertPaymentIntentWire(payment);
|
|
60
|
+
exact(request, ['chain_id', 'settlement', 'slot', 'action', 'payload_digest', 'authorization_commitment']);
|
|
61
|
+
const settlement = new Uint8Array(32);
|
|
62
|
+
settlement.set(protocolHex(payment.settlement, 20, 'payment Settlement'), 12);
|
|
63
|
+
if (request.chain_id !== payment.chain_id || request.action !== ACTIONS[payment.action]
|
|
64
|
+
|| !equalBytes(bytes32(request.settlement), settlement)
|
|
65
|
+
|| toHex(bytes32(request.slot)).toLowerCase() !== payment.slot.toLowerCase()
|
|
66
|
+
|| toHex(bytes32(request.payload_digest)).toLowerCase() !== payment.payload_digest.toLowerCase()
|
|
67
|
+
|| toHex(bytes32(request.authorization_commitment)).toLowerCase() !== paymentIntentHash(payment).toLowerCase())
|
|
68
|
+
throw new Error('Execution evidence differs from the retained payment');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build a public evidence query identity from the locally retained payment, never a server proposal.
|
|
72
|
+
* @param payment Original creator-signed payment. This does not disclose private operation inputs.
|
|
73
|
+
*/
|
|
74
|
+
export function paidExecutionRequest(payment) {
|
|
75
|
+
assertPaymentIntentWire(payment);
|
|
76
|
+
const settlement = new Uint8Array(32);
|
|
77
|
+
settlement.set(protocolHex(payment.settlement, 20, 'payment Settlement'), 12);
|
|
78
|
+
return { chain_id: payment.chain_id, settlement: [...settlement], slot: [...protocolHex(payment.slot, 32, 'payment slot')],
|
|
79
|
+
action: ACTIONS[payment.action], payload_digest: [...protocolHex(payment.payload_digest, 32, 'payment payload digest')],
|
|
80
|
+
authorization_commitment: [...protocolHex(paymentIntentHash(payment), 32, 'payment hash')] };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Reconstruct the Rust worker signing hash for a completed result. This does not verify its signer.
|
|
84
|
+
* @param payment Original retained creator payment, used to recompute the complete request identity.
|
|
85
|
+
* @param report Untrusted completed report with strict wire shape.
|
|
86
|
+
*/
|
|
87
|
+
export function paidExecutionReportSigningHash(payment, report) {
|
|
88
|
+
exact(report, ['request', 'operator_key', 'stage', 'binding', 'reservation_block', 'cost', 'outcome']);
|
|
89
|
+
matchesRequest(payment, report.request);
|
|
90
|
+
exact(report.outcome, ['succeeded']);
|
|
91
|
+
exact(report.outcome.succeeded, ['result_commitment']);
|
|
92
|
+
return packed('keykeeper/prepaid-execution-report/v1', protocolHex(prepaidRequestId(payment), 32, 'request ID'), nonzero(bytes32(report.operator_key)), Uint8Array.of(ordinal(report.stage)), nonzero(bytes32(report.binding)), nonzero(bytes32(report.reservation_block)), nonzero(bytes32(report.cost)), Uint8Array.of(2), nonzero(bytes32(report.outcome.succeeded.result_commitment)));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Authenticate public recovery evidence against independently established historical financial policy.
|
|
96
|
+
* The policy time must equal the original accepted time, not the current recovery clock.
|
|
97
|
+
* @param options Retained payment/client identity, historical creator and fee, expected worker and untrusted evidence.
|
|
98
|
+
*/
|
|
99
|
+
export async function verifyPaidExecutionEvidence(options) {
|
|
100
|
+
exact(options.execution, ['report', 'signature', 'consent']);
|
|
101
|
+
const hash = paidExecutionReportSigningHash(options.payment, options.execution.report);
|
|
102
|
+
executionConsentBinding(options.payment, options.execution.consent, toHex(bytes32(options.execution.report.reservation_block)));
|
|
103
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy }, target = { ...options.target };
|
|
104
|
+
const execution = structuredClone(options.execution), report = execution.report;
|
|
105
|
+
const key = primeKey(target.operatorKey);
|
|
106
|
+
if (report.stage !== target.stage || !equalBytes(bytes32(report.operator_key), key)
|
|
107
|
+
|| BigInt(toHex(bytes32(report.cost))) !== policy.cost
|
|
108
|
+
|| !equalBytes(primeKey(target.executionKey), primeKey(execution.consent.authorization.certificate.execution_key)))
|
|
109
|
+
throw new Error('Recovery evidence identity or TASRA fee mismatch');
|
|
110
|
+
if (!ed25519.verify(protocolHex(execution.signature, 64, 'worker execution signature'), protocolHex(hash, 32, 'execution report hash'), key, { zip215: false }))
|
|
111
|
+
throw new Error('Invalid worker execution signature');
|
|
112
|
+
await verifyExecutionConsent({ payment, policy, consent: execution.consent, expected: { stage: target.stage, operatorKey: target.operatorKey,
|
|
113
|
+
reservationBlock: toHex(bytes32(report.reservation_block)), executionBinding: toHex(bytes32(report.binding)) } });
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Reconstruct the domain-separated fresh read hash. It cannot authorize another paid operation.
|
|
117
|
+
* @param payment Original payment, including its signed assignment and complete request identity.
|
|
118
|
+
* @param authorization Exact stage, worker, original binding, clock and client nonce.
|
|
119
|
+
*/
|
|
120
|
+
export function executionRecoverySigningHash(payment, authorization) {
|
|
121
|
+
assertPaymentIntentWire(payment);
|
|
122
|
+
return packed('keykeeper/client-execution-recovery/v1', protocolHex(prepaidRequestId(payment), 32, 'request ID'), Uint8Array.of(ordinal(authorization.stage)), primeKey(authorization.operator_key), nonzero(protocolHex(authorization.execution_binding, 32, 'recovery execution binding')), uint64(authorization.issued_at), nonzero(protocolHex(authorization.nonce, 32, 'recovery nonce')));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Ask the original local client for a fresh read signature only after verifying work and financial evidence.
|
|
126
|
+
* Applications must supply independently authenticated canonical history, not a server-provided policy.
|
|
127
|
+
* @param options Retained payment, independently selected worker/client, historical policy and fresh clock.
|
|
128
|
+
*/
|
|
129
|
+
export async function createExecutionRecoveryAuthorization(options) {
|
|
130
|
+
exact(options.execution, ['report', 'signature', 'consent']);
|
|
131
|
+
paidExecutionReportSigningHash(options.payment, options.execution.report);
|
|
132
|
+
executionConsentBinding(options.payment, options.execution.consent, toHex(bytes32(options.execution.report.reservation_block)));
|
|
133
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy }, target = { ...options.target };
|
|
134
|
+
const execution = structuredClone(options.execution), signer = options.signer, publicKey = signer.publicKey.slice(), now = options.nowSecs;
|
|
135
|
+
uint64(now);
|
|
136
|
+
if (execution.consent.verified_at > now + 2 || !equalBytes(publicKey, primeKey(target.executionKey)))
|
|
137
|
+
throw new Error('Recovery requires the original client and a fresh clock');
|
|
138
|
+
const nonce = options.nonce ?? toHex(globalThis.crypto.getRandomValues(new Uint8Array(32)));
|
|
139
|
+
await verifyPaidExecutionEvidence({ payment, policy, target, execution });
|
|
140
|
+
const unsigned = { stage: target.stage, operator_key: target.operatorKey, execution_binding: toHex(bytes32(execution.report.binding)), issued_at: now, nonce };
|
|
141
|
+
const hash = protocolHex(executionRecoverySigningHash(payment, unsigned), 32, 'execution recovery hash');
|
|
142
|
+
const signature = await signer.sign(hash.slice());
|
|
143
|
+
if (signature.length !== 64 || !ed25519.verify(signature, hash, primeKey(target.executionKey), { zip215: false }))
|
|
144
|
+
throw new Error('Invalid local execution recovery signature');
|
|
145
|
+
return { ...unsigned, signature: toHex(signature) };
|
|
146
|
+
}
|
|
147
|
+
function resultCommitment(payment, reply) {
|
|
148
|
+
if (typeof reply.result_json !== 'string' || reply.result_json.length > MAX_EXECUTION_BODY_BYTES)
|
|
149
|
+
throw new Error('Invalid recovered result size');
|
|
150
|
+
const bytes = new TextEncoder().encode(reply.result_json);
|
|
151
|
+
if (bytes.length === 0 || bytes.length > MAX_EXECUTION_BODY_BYTES
|
|
152
|
+
|| new TextDecoder('utf-8', { fatal: true }).decode(bytes) !== reply.result_json)
|
|
153
|
+
throw new Error('Invalid recovered result encoding');
|
|
154
|
+
const genericDomain = new TextEncoder().encode('keykeeper/prepaid-execution-result/v1');
|
|
155
|
+
if (reply.encoding === 'json') {
|
|
156
|
+
if (payment.action === 'ibe-extract') {
|
|
157
|
+
const v = parseExecutionJson(bytes, MAX_EXECUTION_BODY_BYTES);
|
|
158
|
+
const allowed = ['key_slot_id', 'identifier', 'epoch', 'verifying_share', 'sealed_share', 'op_id', 'token_hash', 'op_attestation'];
|
|
159
|
+
if (!v || typeof v !== 'object' || Array.isArray(v) || Object.keys(v).some(k => !allowed.includes(k)) || typeof v.key_slot_id !== 'string' || v.key_slot_id.replace(/^0x/, '').toLowerCase() !== payment.slot.slice(2).toLowerCase() || typeof v.epoch !== 'number' || !Number.isSafeInteger(v.epoch) || v.epoch < 0 || typeof v.identifier !== 'number' || !Number.isInteger(v.identifier) || v.identifier < 1 || v.identifier > 65535 || typeof v.verifying_share !== 'string' || base64Decode(v.verifying_share).length !== 144)
|
|
160
|
+
throw new Error('Invalid sealed IBE recovery result');
|
|
161
|
+
const sealed = v.sealed_share;
|
|
162
|
+
if (!sealed || typeof sealed !== 'object' || Array.isArray(sealed) || Object.keys(sealed).sort().join(',') !== 'ciphertext,enc' || typeof sealed.enc !== 'string' || typeof sealed.ciphertext !== 'string' || base64Decode(sealed.enc).length !== 32 || base64Decode(sealed.ciphertext).length !== 64)
|
|
163
|
+
throw new Error('Unsealed or malformed IBE recovery refused');
|
|
164
|
+
}
|
|
165
|
+
return toHex(sha256(new Uint8Array([...genericDomain, ...bytes])));
|
|
166
|
+
}
|
|
167
|
+
if (payment.action !== 'ibe-extract' || reply.encoding !== 'ibe-extract')
|
|
168
|
+
throw new Error('Recovered result commitment scheme mismatch');
|
|
169
|
+
const domain = new TextEncoder().encode('keykeeper/prepaid-ibe-result/v1');
|
|
170
|
+
// Inspect only the fields in the existing IBE commitment; later audit metadata is not its preimage.
|
|
171
|
+
const value = parseExecutionJson(bytes, MAX_EXECUTION_BODY_BYTES);
|
|
172
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
173
|
+
throw new Error('Invalid recovered IBE result');
|
|
174
|
+
const share = value;
|
|
175
|
+
if (typeof share.key_slot_id !== 'string' || typeof share.epoch !== 'number' || !Number.isSafeInteger(share.epoch)
|
|
176
|
+
|| typeof share.identifier !== 'number' || !Number.isInteger(share.identifier) || share.identifier < 0 || share.identifier > 65535
|
|
177
|
+
|| typeof share.extraction_share !== 'string' || typeof share.verifying_share !== 'string'
|
|
178
|
+
|| share.key_slot_id.replace(/^0x/, '').toLowerCase() !== payment.slot.slice(2).toLowerCase())
|
|
179
|
+
throw new Error('Invalid recovered IBE commitment fields');
|
|
180
|
+
const epoch = new Uint8Array(8), identifier = new Uint8Array(2);
|
|
181
|
+
new DataView(epoch.buffer).setBigInt64(0, BigInt(share.epoch));
|
|
182
|
+
new DataView(identifier.buffer).setUint16(0, share.identifier);
|
|
183
|
+
return toHex(sha256(new Uint8Array([...domain, ...protocolHex(share.key_slot_id, 32, 'IBE slot'), ...epoch, ...identifier,
|
|
184
|
+
...new TextEncoder().encode(share.extraction_share), ...new TextEncoder().encode(share.verifying_share)])));
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Verify the returned worker evidence and exact result bytes against the previously authenticated report.
|
|
188
|
+
* Returns the retained JSON string only after its commitment matches; callers decode the operation's
|
|
189
|
+
* internal result format themselves. It may differ from the original HTTP envelope and audit metadata.
|
|
190
|
+
* @param options Original identity and history, authenticated expected report, and untrusted response.
|
|
191
|
+
*/
|
|
192
|
+
export async function verifyRecoveredExecutionResult(options) {
|
|
193
|
+
exact(options.reply, ['execution', 'encoding', 'result_json']);
|
|
194
|
+
const payment = structuredClone(options.payment), policy = { ...options.policy }, target = { ...options.target };
|
|
195
|
+
const expectedExecution = structuredClone(options.expectedExecution), reply = structuredClone(options.reply);
|
|
196
|
+
await verifyPaidExecutionEvidence({ payment, policy, target, execution: expectedExecution });
|
|
197
|
+
await verifyPaidExecutionEvidence({ payment, policy, target, execution: reply.execution });
|
|
198
|
+
if (paidExecutionReportSigningHash(payment, expectedExecution.report) !== paidExecutionReportSigningHash(payment, reply.execution.report)
|
|
199
|
+
|| resultCommitment(payment, reply).toLowerCase() !== toHex(bytes32(expectedExecution.report.outcome.succeeded.result_commitment)))
|
|
200
|
+
throw new Error('Recovered execution result commitment mismatch');
|
|
201
|
+
// Require JSON after authenticating exact bytes; canonicalizing here would change the committed format.
|
|
202
|
+
parseExecutionJson(new TextEncoder().encode(reply.result_json), MAX_EXECUTION_BODY_BYTES);
|
|
203
|
+
return reply.result_json;
|
|
204
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Bounded duplicate-refusing JSON at the public evidence and private recovery boundary. */
|
|
2
|
+
export function parseExecutionJson(bytes, maxBytes) {
|
|
3
|
+
if (!(bytes instanceof Uint8Array) || bytes.length === 0 || bytes.length > maxBytes)
|
|
4
|
+
throw new Error('Execution response exceeds its byte bound');
|
|
5
|
+
try {
|
|
6
|
+
const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
7
|
+
let position = 0, nodes = 0;
|
|
8
|
+
const whitespace = () => { while (/^[\t\n\r ]$/.test(text[position] ?? ''))
|
|
9
|
+
position++; };
|
|
10
|
+
const string = () => {
|
|
11
|
+
const start = position++;
|
|
12
|
+
while (position < text.length) {
|
|
13
|
+
const char = text[position++];
|
|
14
|
+
if (char === '\\')
|
|
15
|
+
position++;
|
|
16
|
+
else if (char === '"') {
|
|
17
|
+
const decoded = JSON.parse(text.slice(start, position));
|
|
18
|
+
for (const point of decoded) {
|
|
19
|
+
const code = point.charCodeAt(0);
|
|
20
|
+
if (point.length === 1 && code >= 0xd800 && code <= 0xdfff)
|
|
21
|
+
throw new Error('Invalid execution JSON Unicode scalar');
|
|
22
|
+
}
|
|
23
|
+
return decoded;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw new Error('Unterminated execution JSON string');
|
|
27
|
+
};
|
|
28
|
+
const value = (depth) => {
|
|
29
|
+
if (depth > 32 || ++nodes > 65_536)
|
|
30
|
+
throw new Error('Execution JSON exceeds its structural bound');
|
|
31
|
+
whitespace();
|
|
32
|
+
const char = text[position];
|
|
33
|
+
if (char === '"') {
|
|
34
|
+
string();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (char === '{' || char === '[') {
|
|
38
|
+
const object = char === '{', end = object ? '}' : ']', keys = new Set();
|
|
39
|
+
position++;
|
|
40
|
+
whitespace();
|
|
41
|
+
if (text[position] === end) {
|
|
42
|
+
position++;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
while (position < text.length) {
|
|
46
|
+
whitespace();
|
|
47
|
+
if (object) {
|
|
48
|
+
if (text[position] !== '"')
|
|
49
|
+
throw new Error('Invalid execution JSON object key');
|
|
50
|
+
const key = string();
|
|
51
|
+
if (keys.has(key))
|
|
52
|
+
throw new Error('Duplicate execution JSON key');
|
|
53
|
+
keys.add(key);
|
|
54
|
+
whitespace();
|
|
55
|
+
if (text[position++] !== ':')
|
|
56
|
+
throw new Error('Invalid execution JSON object delimiter');
|
|
57
|
+
}
|
|
58
|
+
value(depth + 1);
|
|
59
|
+
whitespace();
|
|
60
|
+
if (text[position] === end) {
|
|
61
|
+
position++;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (text[position++] !== ',')
|
|
65
|
+
throw new Error('Invalid execution JSON delimiter');
|
|
66
|
+
}
|
|
67
|
+
throw new Error('Unterminated execution JSON container');
|
|
68
|
+
}
|
|
69
|
+
const start = position;
|
|
70
|
+
while (position < text.length && !/[\t\n\r ,\]}]/.test(text[position]))
|
|
71
|
+
position++;
|
|
72
|
+
if (start === position)
|
|
73
|
+
throw new Error('Invalid execution JSON value');
|
|
74
|
+
const scalar = JSON.parse(text.slice(start, position));
|
|
75
|
+
if (typeof scalar === 'number' && (!Number.isFinite(scalar) || Math.abs(scalar) > Number.MAX_SAFE_INTEGER))
|
|
76
|
+
throw new Error('Unsafe execution JSON number');
|
|
77
|
+
};
|
|
78
|
+
value(0);
|
|
79
|
+
whitespace();
|
|
80
|
+
if (position !== text.length)
|
|
81
|
+
throw new Error('Trailing execution JSON bytes');
|
|
82
|
+
return JSON.parse(text);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
throw new Error('Invalid or ambiguous execution response JSON');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
+
import { type ClientRecipient } from '../crypto/recipient.js';
|
|
2
|
+
import type { RequestBindingPreimage } from './client.js';
|
|
3
|
+
import type { PaymentIntentWire } from './payment.js';
|
|
1
4
|
import { type VerifierProof, type CommitteeDecryptOpts } from './client.js';
|
|
2
5
|
import { type IbeCiphertext } from '../crypto/ibe.js';
|
|
3
6
|
import { type TokenType, type CompoundTokenWire } from './token.js';
|
|
4
7
|
import { type HolderSigner } from '../auth/holderProof.js';
|
|
5
8
|
import type { FrostSignResult } from '../signing/frost.js';
|
|
6
|
-
|
|
7
|
-
* client request signature. The client (== the credential holder) proves it authorized
|
|
8
|
-
* this exact request by signing `clientBindingHash(slotId, tokenHash)`. Supply an ed25519 signer
|
|
9
|
-
* (the holder's authentication key) - the keeper (hot path) and the accountant (audit) verify it.
|
|
10
|
-
*/
|
|
11
|
-
export interface ClientSigner {
|
|
12
|
-
/** 32-byte ed25519 public key. */
|
|
13
|
-
publicKey: Uint8Array;
|
|
14
|
-
/** Sign the 32-byte client-binding hash to 64-byte ed25519 signature. */
|
|
15
|
-
sign(bindingHash: Uint8Array): Uint8Array | Promise<Uint8Array>;
|
|
16
|
-
}
|
|
9
|
+
import type { KeeperExecutionApprover } from './keeperExecution.js';
|
|
17
10
|
/**
|
|
18
11
|
* Callback that mints a separate holder proof for each verifier.
|
|
19
12
|
*
|
|
@@ -40,12 +33,6 @@ export declare function holderProofPerVerifier(opts: {
|
|
|
40
33
|
action?: string;
|
|
41
34
|
ttlSecs?: number;
|
|
42
35
|
}): HolderProofPerVerifier;
|
|
43
|
-
/**
|
|
44
|
-
* A {@link ClientSigner} from a 32-byte ed25519 secret key (the common `did:key` holder).
|
|
45
|
-
*
|
|
46
|
-
* @param secretKey - 32-byte Ed25519 secret seed used to sign client request bindings.
|
|
47
|
-
*/
|
|
48
|
-
export declare function ed25519ClientSigner(secretKey: Uint8Array): ClientSigner;
|
|
49
36
|
/** One member of the active verifier set. `operator`+`pubkey` are needed only to build the
|
|
50
37
|
* trustless snapshot proofs; `index`+`url` alone suffice for the keeper's configured-set path. */
|
|
51
38
|
export interface CommitteeVerifier {
|
|
@@ -75,6 +62,25 @@ export interface CommitteeChainReads {
|
|
|
75
62
|
root: `0x${string}` | Uint8Array;
|
|
76
63
|
size: number;
|
|
77
64
|
} | null>;
|
|
65
|
+
/**
|
|
66
|
+
* The whole draw - beacon epoch, its seed and its anchored verifier snapshot - read at ONE block
|
|
67
|
+
* (`oneBlockDraw` in the chain layer). Preferred whenever present: separate reads can pair epoch N
|
|
68
|
+
* with seed N+1 across a beacon push (robustness audit 2026-11-13, P6).
|
|
69
|
+
*/
|
|
70
|
+
drawAt?(epochLag?: number): Promise<CommitteeDraw>;
|
|
71
|
+
}
|
|
72
|
+
/** A committee draw read at one block: the epoch, its seed and its anchored verifier snapshot. */
|
|
73
|
+
export interface CommitteeDraw {
|
|
74
|
+
/** Beacon epoch the draw is pinned to. */
|
|
75
|
+
epoch: number;
|
|
76
|
+
/** That epoch's anchored seed. */
|
|
77
|
+
seed: `0x${string}`;
|
|
78
|
+
/** The epoch's anchored verifier-set snapshot root. */
|
|
79
|
+
root: `0x${string}`;
|
|
80
|
+
/** The snapshot's registry size: the draw modulus. */
|
|
81
|
+
size: number;
|
|
82
|
+
/** The block all three were read at. */
|
|
83
|
+
blockHash: `0x${string}`;
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
80
86
|
* Adapt the SDK chain client's `readers` into {@link CommitteeChainReads}.
|
|
@@ -96,6 +102,10 @@ export declare function committeeChainReadsFromClient(readers: {
|
|
|
96
102
|
}): CommitteeChainReads;
|
|
97
103
|
/** Chain reads, verifier directory, credential presentation and optional request-signing context. */
|
|
98
104
|
export interface RequestCommitteeTokenOpts {
|
|
105
|
+
/** Exact chain-, slot-, action- and payload-bound authorization preimage; decryption must include the recipient-bound digest. */
|
|
106
|
+
binding?: RequestBindingPreimage;
|
|
107
|
+
/** Original creator-signed payment intent for the already reserved operation. */
|
|
108
|
+
payment?: PaymentIntentWire;
|
|
99
109
|
/** Reader methods for the beacon and slot verifier policy. */
|
|
100
110
|
chain: CommitteeChainReads;
|
|
101
111
|
/** Pin the draw to `latest - epochLag` (0 or 1). 1 = the previous epoch, always anchored: no wait for the accountants. */
|
|
@@ -119,14 +129,13 @@ export interface RequestCommitteeTokenOpts {
|
|
|
119
129
|
ttlSecs?: number;
|
|
120
130
|
/** Override "now" (unix seconds), mainly for tests. */
|
|
121
131
|
nowSecs?: number;
|
|
122
|
-
/** sign the request bundle with the holder's key so the keeper + audit can verify
|
|
123
|
-
* the user authorized this operation. Omit to skip (keeper accepts unless it requires it). */
|
|
124
|
-
clientSigner?: ClientSigner;
|
|
125
132
|
/** Identity string for an IBE-scoped operation. Verifiers bind its hash into the token and evaluate the credential scope. Omit for group signing and group decryption; ciphertext associated data is a separate field. */
|
|
126
133
|
scopedIdentity?: string;
|
|
127
134
|
}
|
|
128
135
|
/** Assembled compound token, committee draw and optional proofs and client signature. */
|
|
129
136
|
export interface CommitteeTokenResult {
|
|
137
|
+
/** Exact sealed presentation ciphertext returned with the token. */
|
|
138
|
+
evidenceCt?: string;
|
|
130
139
|
/** Compound committee authorization token. */
|
|
131
140
|
token: CompoundTokenWire;
|
|
132
141
|
/** Number of verifiers selected for the committee. */
|
|
@@ -142,10 +151,6 @@ export interface CommitteeTokenResult {
|
|
|
142
151
|
/** Trustless snapshot-inclusion proofs for the token's signers, when derivable; else
|
|
143
152
|
* `undefined` (the keeper then uses its configured verifier set). */
|
|
144
153
|
verifierProofs?: VerifierProof[];
|
|
145
|
-
/** Ed25519 client public key corresponding to clientSignature, when a client signer was supplied. */
|
|
146
|
-
clientPubkey?: Uint8Array;
|
|
147
|
-
/** Client signature over the slot and compound token binding. */
|
|
148
|
-
clientSignature?: Uint8Array;
|
|
149
154
|
/** Policy version reported by the verifiers, when available. Diagnostic only; the keeper enforces the token rule hash against its current rule. */
|
|
150
155
|
ruleVersion?: number;
|
|
151
156
|
}
|
|
@@ -187,6 +192,8 @@ export declare function requestCommitteeToken(opts: RequestCommitteeTokenOpts):
|
|
|
187
192
|
/** Operation-specific fields for {@link committeeSignRequest} (everything `committeeSign` needs
|
|
188
193
|
* except the token, which this resolves). */
|
|
189
194
|
export interface CommitteeSignRequestOpts extends RequestCommitteeTokenOpts {
|
|
195
|
+
/** Client-owned exact-body approval capability, required when authorization carries payment. */
|
|
196
|
+
approveExecution?: KeeperExecutionApprover;
|
|
190
197
|
/** Keeper HTTP base URL. */
|
|
191
198
|
nodeUrl: string;
|
|
192
199
|
/** Raw message bytes to sign. */
|
|
@@ -206,16 +213,30 @@ export interface CommitteeSignRequestOpts extends RequestCommitteeTokenOpts {
|
|
|
206
213
|
export declare function committeeSignRequest(opts: CommitteeSignRequestOpts): Promise<FrostSignResult>;
|
|
207
214
|
/** Operation-specific fields for {@link committeeDecryptRequest}. */
|
|
208
215
|
export interface CommitteeDecryptRequestOpts extends RequestCommitteeTokenOpts {
|
|
216
|
+
/** Original client-held recipient, created before authorization; required at runtime. */
|
|
217
|
+
recipient?: ClientRecipient;
|
|
218
|
+
/** Distinct assigned keeper endpoints; required for client-sealed contribution collection. */
|
|
219
|
+
nodeUrls?: string[];
|
|
220
|
+
/** Independently authenticated 144-byte G2 || G1 public shares indexed by participant identifier. */
|
|
221
|
+
verifyingShares?: ReadonlyMap<number, Uint8Array>;
|
|
222
|
+
/** Required distinct verified contribution count, matching the canonical sharing. */
|
|
223
|
+
threshold?: number;
|
|
224
|
+
/** Cancel authorization and contribution collection. */
|
|
225
|
+
signal?: AbortSignal;
|
|
226
|
+
/** Guarded keeper HTTP transport; defaults to global fetch. */
|
|
227
|
+
fetchImpl?: typeof fetch;
|
|
228
|
+
/** Client-owned exact-body approval capability, required when authorization carries payment. */
|
|
229
|
+
approveExecution?: KeeperExecutionApprover;
|
|
209
230
|
/** Keeper HTTP base URL. */
|
|
210
|
-
nodeUrl
|
|
231
|
+
nodeUrl?: string;
|
|
211
232
|
/** Ciphertext to decrypt. */
|
|
212
233
|
ciphertext: CommitteeDecryptOpts['ciphertext'];
|
|
213
234
|
/** Original encryption associated data. */
|
|
214
235
|
identity: Uint8Array;
|
|
215
236
|
/** Threshold participant identifiers for the decryption ceremony. */
|
|
216
|
-
decryptingSet
|
|
237
|
+
decryptingSet?: number[];
|
|
217
238
|
/** Peer identifiers for the selected BLS participants. */
|
|
218
|
-
blsPeers
|
|
239
|
+
blsPeers?: CommitteeDecryptOpts['blsPeers'];
|
|
219
240
|
/** Optional Ed25519 owner signature over the canonical operation request. */
|
|
220
241
|
userSignature?: Uint8Array;
|
|
221
242
|
/** Expected key epoch of the ciphertext; used to detect rotation. */
|
|
@@ -231,6 +252,21 @@ export interface CommitteeDecryptRequestOpts extends RequestCommitteeTokenOpts {
|
|
|
231
252
|
export declare function committeeDecryptRequest(opts: CommitteeDecryptRequestOpts): Promise<Uint8Array>;
|
|
232
253
|
/** Operation-specific fields for {@link ibeDecryptRequest} / {@link ibeExtractRequest}. */
|
|
233
254
|
export interface IbeExtractRequestOpts extends RequestCommitteeTokenOpts {
|
|
255
|
+
/** Original client-held recipient bound by the authorization; required at runtime. */
|
|
256
|
+
recipient?: ClientRecipient;
|
|
257
|
+
/** Independently authenticated 144-byte G2 || G1 public shares indexed by participant identifier. */
|
|
258
|
+
verifyingShares?: ReadonlyMap<number, Uint8Array>;
|
|
259
|
+
/** Keeper threshold from independently read slot metadata. When supplied,
|
|
260
|
+
* finish after that many distinct pairing-verified shares, cancelling the rest. */
|
|
261
|
+
threshold?: number;
|
|
262
|
+
/** Keeper extraction deadline in milliseconds; default 10000. */
|
|
263
|
+
timeoutMs?: number;
|
|
264
|
+
/** Cancel the extraction fan-out. Does not undo already started keeper work. */
|
|
265
|
+
signal?: AbortSignal;
|
|
266
|
+
/** HTTP transport override for keeper extraction requests. */
|
|
267
|
+
fetchImpl?: typeof fetch;
|
|
268
|
+
/** Client-owned exact-body approval capability for each paid extraction contributor. */
|
|
269
|
+
approveExecution?: KeeperExecutionApprover;
|
|
234
270
|
/** Base URLs of at least k keeper nodes holding the slot's BLS shards. */
|
|
235
271
|
nodeUrls: string[];
|
|
236
272
|
/** The IBE identity to extract for - becomes the token's `scopedIdentity`, so a quorum
|