@did-btcr2/method 0.36.0 → 0.37.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/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +1371 -260
- package/dist/browser.mjs +1371 -260
- package/dist/cjs/index.js +1464 -343
- package/dist/esm/core/aggregation/beacon-strategy.js +19 -6
- package/dist/esm/core/aggregation/beacon-strategy.js.map +1 -1
- package/dist/esm/core/aggregation/cohort.js +142 -33
- package/dist/esm/core/aggregation/cohort.js.map +1 -1
- package/dist/esm/core/aggregation/conditions.js +27 -0
- package/dist/esm/core/aggregation/conditions.js.map +1 -1
- package/dist/esm/core/aggregation/fallback-spend.js +132 -0
- package/dist/esm/core/aggregation/fallback-spend.js.map +1 -0
- package/dist/esm/core/aggregation/messages/base.js.map +1 -1
- package/dist/esm/core/aggregation/messages/bodies.js +46 -1
- package/dist/esm/core/aggregation/messages/bodies.js.map +1 -1
- package/dist/esm/core/aggregation/messages/constants.js +11 -0
- package/dist/esm/core/aggregation/messages/constants.js.map +1 -1
- package/dist/esm/core/aggregation/messages/factories.js +27 -1
- package/dist/esm/core/aggregation/messages/factories.js.map +1 -1
- package/dist/esm/core/aggregation/messages/guards.js +4 -1
- package/dist/esm/core/aggregation/messages/guards.js.map +1 -1
- package/dist/esm/core/aggregation/participant.js +218 -18
- package/dist/esm/core/aggregation/participant.js.map +1 -1
- package/dist/esm/core/aggregation/phases.js +6 -0
- package/dist/esm/core/aggregation/phases.js.map +1 -1
- package/dist/esm/core/aggregation/recovery-policy.js +156 -0
- package/dist/esm/core/aggregation/recovery-policy.js.map +1 -0
- package/dist/esm/core/aggregation/recovery-spend.js +106 -0
- package/dist/esm/core/aggregation/recovery-spend.js.map +1 -0
- package/dist/esm/core/aggregation/runner/aggregation-runner.js +11 -3
- package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +1 -1
- package/dist/esm/core/aggregation/runner/participant-runner.js +106 -19
- package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
- package/dist/esm/core/aggregation/runner/service-runner.js +409 -195
- package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -1
- package/dist/esm/core/aggregation/service.js +221 -11
- package/dist/esm/core/aggregation/service.js.map +1 -1
- package/dist/esm/core/aggregation/signing-session.js +3 -3
- package/dist/esm/core/aggregation/signing-session.js.map +1 -1
- package/dist/esm/core/aggregation/transport/http/envelope.js +3 -3
- package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +1 -1
- package/dist/esm/core/aggregation/transport/http/nonce-cache.js +1 -1
- package/dist/esm/core/aggregation/transport/http/rate-limiter.js +1 -1
- package/dist/esm/core/aggregation/transport/http/request-auth.js +1 -1
- package/dist/esm/core/aggregation/transport/http/server.js +1 -1
- package/dist/esm/core/aggregation/transport/http/sse-stream.js +1 -1
- package/dist/esm/core/aggregation/transport/http/sse-writer.js +1 -1
- package/dist/esm/core/aggregation/transport/in-memory.js +1 -1
- package/dist/esm/core/aggregation/transport/nostr.js +6 -6
- package/dist/esm/core/beacon/beacon.js +15 -10
- package/dist/esm/core/beacon/beacon.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +6 -6
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
- package/dist/esm/core/beacon/singleton-beacon.js +2 -2
- package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +3 -3
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
- package/dist/esm/core/resolver.js +8 -8
- package/dist/esm/core/resolver.js.map +1 -1
- package/dist/esm/core/updater.js +6 -6
- package/dist/esm/core/updater.js.map +1 -1
- package/dist/esm/did-btcr2.js +2 -2
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/core/aggregation/beacon-strategy.d.ts +8 -4
- package/dist/types/core/aggregation/beacon-strategy.d.ts.map +1 -1
- package/dist/types/core/aggregation/cohort.d.ts +88 -17
- package/dist/types/core/aggregation/cohort.d.ts.map +1 -1
- package/dist/types/core/aggregation/conditions.d.ts +28 -0
- package/dist/types/core/aggregation/conditions.d.ts.map +1 -1
- package/dist/types/core/aggregation/fallback-spend.d.ts +94 -0
- package/dist/types/core/aggregation/fallback-spend.d.ts.map +1 -0
- package/dist/types/core/aggregation/logger.d.ts +1 -1
- package/dist/types/core/aggregation/messages/base.d.ts +6 -0
- package/dist/types/core/aggregation/messages/base.d.ts.map +1 -1
- package/dist/types/core/aggregation/messages/bodies.d.ts +50 -2
- package/dist/types/core/aggregation/messages/bodies.d.ts.map +1 -1
- package/dist/types/core/aggregation/messages/constants.d.ts +8 -0
- package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -1
- package/dist/types/core/aggregation/messages/factories.d.ts +40 -0
- package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -1
- package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -1
- package/dist/types/core/aggregation/participant.d.ts +47 -4
- package/dist/types/core/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/aggregation/phases.d.ts +8 -2
- package/dist/types/core/aggregation/phases.d.ts.map +1 -1
- package/dist/types/core/aggregation/recovery-policy.d.ts +132 -0
- package/dist/types/core/aggregation/recovery-policy.d.ts.map +1 -0
- package/dist/types/core/aggregation/recovery-spend.d.ts +94 -0
- package/dist/types/core/aggregation/recovery-spend.d.ts.map +1 -0
- package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +13 -3
- package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/events.d.ts +48 -16
- package/dist/types/core/aggregation/runner/events.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/participant-runner.d.ts +23 -14
- package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/service-runner.d.ts +102 -23
- package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -1
- package/dist/types/core/aggregation/service.d.ts +26 -2
- package/dist/types/core/aggregation/service.d.ts.map +1 -1
- package/dist/types/core/aggregation/signing-session.d.ts +2 -2
- package/dist/types/core/aggregation/signing-session.d.ts.map +1 -1
- package/dist/types/core/aggregation/transport/http/envelope.d.ts +3 -3
- package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +1 -1
- package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +1 -1
- package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +1 -1
- package/dist/types/core/aggregation/transport/http/request-auth.d.ts +1 -1
- package/dist/types/core/aggregation/transport/http/server.d.ts +1 -1
- package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +2 -2
- package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +1 -1
- package/dist/types/core/aggregation/transport/in-memory.d.ts +1 -1
- package/dist/types/core/aggregation/transport/nostr.d.ts +4 -4
- package/dist/types/core/aggregation/transport/transport.d.ts +4 -4
- package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts +7 -7
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +2 -2
- package/dist/types/core/beacon/interfaces.d.ts +1 -1
- package/dist/types/core/resolver.d.ts +3 -3
- package/dist/types/core/updater.d.ts +4 -4
- package/dist/types/did-btcr2.d.ts +2 -2
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/aggregation/beacon-strategy.ts +27 -9
- package/src/core/aggregation/cohort.ts +171 -35
- package/src/core/aggregation/conditions.ts +56 -0
- package/src/core/aggregation/fallback-spend.ts +223 -0
- package/src/core/aggregation/logger.ts +1 -1
- package/src/core/aggregation/messages/base.ts +6 -0
- package/src/core/aggregation/messages/bodies.ts +94 -1
- package/src/core/aggregation/messages/constants.ts +12 -0
- package/src/core/aggregation/messages/factories.ts +57 -0
- package/src/core/aggregation/messages/guards.ts +6 -0
- package/src/core/aggregation/participant.ts +264 -20
- package/src/core/aggregation/phases.ts +9 -0
- package/src/core/aggregation/recovery-policy.ts +237 -0
- package/src/core/aggregation/recovery-spend.ts +192 -0
- package/src/core/aggregation/runner/aggregation-runner.ts +27 -5
- package/src/core/aggregation/runner/events.ts +47 -19
- package/src/core/aggregation/runner/participant-runner.ts +113 -31
- package/src/core/aggregation/runner/service-runner.ts +484 -203
- package/src/core/aggregation/service.ts +260 -14
- package/src/core/aggregation/signing-session.ts +3 -3
- package/src/core/aggregation/transport/http/envelope.ts +3 -3
- package/src/core/aggregation/transport/http/inbox-buffer.ts +1 -1
- package/src/core/aggregation/transport/http/nonce-cache.ts +1 -1
- package/src/core/aggregation/transport/http/rate-limiter.ts +1 -1
- package/src/core/aggregation/transport/http/request-auth.ts +1 -1
- package/src/core/aggregation/transport/http/server.ts +1 -1
- package/src/core/aggregation/transport/http/sse-stream.ts +2 -2
- package/src/core/aggregation/transport/http/sse-writer.ts +1 -1
- package/src/core/aggregation/transport/in-memory.ts +1 -1
- package/src/core/aggregation/transport/nostr.ts +6 -6
- package/src/core/aggregation/transport/transport.ts +4 -4
- package/src/core/beacon/beacon.ts +16 -11
- package/src/core/beacon/cas-beacon.ts +7 -7
- package/src/core/beacon/interfaces.ts +1 -1
- package/src/core/beacon/singleton-beacon.ts +2 -2
- package/src/core/beacon/smt-beacon.ts +3 -3
- package/src/core/resolver.ts +8 -8
- package/src/core/updater.ts +6 -6
- package/src/did-btcr2.ts +2 -2
- package/src/index.ts +3 -0
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
2
2
|
import type { SerializedSMTProof } from '@did-btcr2/smt';
|
|
3
3
|
import type { CASAnnouncement } from '../types.js';
|
|
4
|
+
import type { FundingModel } from './recovery-policy.js';
|
|
4
5
|
export type AggregationCohortParams = {
|
|
5
6
|
id?: string;
|
|
6
7
|
serviceDid?: string;
|
|
7
8
|
minParticipants?: number;
|
|
8
9
|
network: string;
|
|
9
10
|
beaconType?: string;
|
|
11
|
+
/** Operator recovery key, x-only (32 bytes). Required to compute the beacon address. */
|
|
12
|
+
recoveryKey?: Uint8Array;
|
|
13
|
+
/** Relative-timelock (BIP-68 nSequence) before recovery is spendable. Required to compute the beacon address. */
|
|
14
|
+
recoverySequence?: number;
|
|
15
|
+
/** Funding model governing the recovery leaves. Defaults to 'operator-funded'. */
|
|
16
|
+
fundingModel?: FundingModel;
|
|
17
|
+
/** Advertised k of the k-of-n fallback leaf. Absent defaults to n-1 at address computation. */
|
|
18
|
+
fallbackThreshold?: number;
|
|
10
19
|
};
|
|
11
20
|
/**
|
|
12
|
-
* Represents an Aggregation Cohort
|
|
21
|
+
* Represents an Aggregation Cohort: a set of Aggregation Participants who
|
|
13
22
|
* submitted cryptographic material to an Aggregation Service to coordinate
|
|
14
23
|
* signing of a shared n-of-n MuSig2 Bitcoin transaction.
|
|
15
24
|
*
|
|
16
|
-
* This is a pure data class
|
|
25
|
+
* This is a pure data class: it holds cohort state and provides computation
|
|
17
26
|
* helpers (key aggregation, CAS Announcement building, SMT tree building).
|
|
18
27
|
* It performs no I/O and emits no messages. Both AggregationService and
|
|
19
28
|
* AggregationParticipant create their own AggregationCohort instances to
|
|
@@ -36,23 +45,48 @@ export declare class AggregationCohort {
|
|
|
36
45
|
/** List of participant DIDs that have been accepted into the cohort. */
|
|
37
46
|
participants: Array<string>;
|
|
38
47
|
/**
|
|
39
|
-
* Mapping from participant DID
|
|
40
|
-
* Distinct from {@link cohortKeys} (which is sorted per BIP-327)
|
|
48
|
+
* Mapping from participant DID to their compressed secp256k1 public key.
|
|
49
|
+
* Distinct from {@link cohortKeys} (which is sorted per BIP-327): this lets
|
|
41
50
|
* callers look up a participant's key without knowing their position in the
|
|
42
51
|
* sorted array. Populated by the service at `acceptParticipant` time.
|
|
43
52
|
*/
|
|
44
53
|
participantKeys: Map<string, Uint8Array>;
|
|
45
54
|
/**
|
|
46
|
-
* BIP-341 TapTweak
|
|
47
|
-
*
|
|
48
|
-
*
|
|
55
|
+
* BIP-341 TapTweak scalar: `taggedHash("TapTweak", internalPubkey || tapMerkleRoot)`.
|
|
56
|
+
* The beacon output is an internal key (the MuSig2 aggregate) plus a script
|
|
57
|
+
* tree (the recovery leaves), so the tweak commits to the tree's Merkle root.
|
|
58
|
+
* The MuSig2 signing session applies this as an x-only tweak; a value that does
|
|
59
|
+
* not match the root the funded address was derived from silently yields an
|
|
60
|
+
* invalid key-path signature.
|
|
49
61
|
*/
|
|
50
62
|
tapTweak: Uint8Array;
|
|
51
|
-
/** The n-of-n MuSig2
|
|
63
|
+
/** The n-of-n MuSig2 aggregate internal key, x-only (32 bytes), set by computeBeaconAddress(). */
|
|
64
|
+
internalKey: Uint8Array;
|
|
65
|
+
/** BIP-341 Taproot Merkle root of the recovery script tree, set by computeBeaconAddress(). */
|
|
66
|
+
tapMerkleRoot: Uint8Array;
|
|
67
|
+
/** Operator recovery key, x-only (32 bytes). Used to build the CSV recovery leaf. */
|
|
68
|
+
recoveryKey?: Uint8Array;
|
|
69
|
+
/** Relative-timelock (BIP-68 nSequence) before the recovery leaf is spendable. */
|
|
70
|
+
recoverySequence?: number;
|
|
71
|
+
/** Funding model governing the recovery leaves (default 'operator-funded'). */
|
|
72
|
+
fundingModel: FundingModel;
|
|
73
|
+
/**
|
|
74
|
+
* Advertised k of the k-of-n fallback leaf, or undefined to default to n-1 at
|
|
75
|
+
* address computation. Read the resolved value via {@link effectiveFallbackThreshold}.
|
|
76
|
+
*/
|
|
77
|
+
fallbackThreshold?: number;
|
|
78
|
+
/** The Taproot beacon address: key path is the MuSig2 aggregate, script path is fallback + recovery. */
|
|
52
79
|
beaconAddress: string;
|
|
53
80
|
/** Pending DID updates submitted by participants, keyed by DID. */
|
|
54
81
|
pendingUpdates: Map<string, SignedBTCR2Update>;
|
|
55
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Participant DIDs that explicitly declined to submit an update this round
|
|
84
|
+
* (cooperative non-inclusion). A decliner is absent from the CAS Announcement
|
|
85
|
+
* Map and carries a non-inclusion leaf in the SMT, yet still signs. Kept
|
|
86
|
+
* disjoint from {@link pendingUpdates} so CAS correctness holds by construction.
|
|
87
|
+
*/
|
|
88
|
+
nonIncluded: Set<string>;
|
|
89
|
+
/** CAS Beacon Announcement Map (DID to updateHash), set by buildCASAnnouncement(). */
|
|
56
90
|
casAnnouncement?: CASAnnouncement;
|
|
57
91
|
/** Per-participant SMT proofs, set by buildSMTTree(). */
|
|
58
92
|
smtProofs?: Map<string, SerializedSMTProof>;
|
|
@@ -62,13 +96,28 @@ export declare class AggregationCohort {
|
|
|
62
96
|
validationAcks: Set<string>;
|
|
63
97
|
/** Set of participant DIDs that have rejected the aggregated data. */
|
|
64
98
|
validationRejections: Set<string>;
|
|
65
|
-
constructor({ id, minParticipants, serviceDid, network, beaconType }: AggregationCohortParams);
|
|
99
|
+
constructor({ id, minParticipants, serviceDid, network, beaconType, recoveryKey, recoverySequence, fundingModel, fallbackThreshold }: AggregationCohortParams);
|
|
66
100
|
/** Sorted cohort keys (sorted on assignment per BIP-327). */
|
|
67
101
|
get cohortKeys(): Array<Uint8Array>;
|
|
68
102
|
set cohortKeys(keys: Array<Uint8Array>);
|
|
69
103
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
104
|
+
* The resolved k of the k-of-n fallback leaf: the advertised
|
|
105
|
+
* {@link fallbackThreshold}, or n-1 (floored at 1) when unadvertised, where n is
|
|
106
|
+
* the current cohort size. This is the value the beacon address commits to and
|
|
107
|
+
* the spend builders must reproduce. Returns 0 before any cohort keys are set.
|
|
108
|
+
*/
|
|
109
|
+
get effectiveFallbackThreshold(): number;
|
|
110
|
+
/**
|
|
111
|
+
* Computes the Taproot beacon address from the cohort keys and recovery params.
|
|
112
|
+
*
|
|
113
|
+
* The output's key path is the n-of-n MuSig2 aggregate of the cohort keys; its
|
|
114
|
+
* script path is the recovery tree (a CSV recovery leaf so a missing signer
|
|
115
|
+
* cannot permanently lock the UTXO). Sets `internalKey`, `tapMerkleRoot`, and
|
|
116
|
+
* the `tapTweak` the MuSig2 session must apply for the key-path spend.
|
|
117
|
+
*
|
|
118
|
+
* The tweak is derived from the Merkle root the address was built with (read
|
|
119
|
+
* back from the payment), never recomputed by hand, so the MuSig2 key-path
|
|
120
|
+
* signature is guaranteed to validate against the funded address.
|
|
72
121
|
*/
|
|
73
122
|
computeBeaconAddress(): string;
|
|
74
123
|
/**
|
|
@@ -84,17 +133,39 @@ export declare class AggregationCohort {
|
|
|
84
133
|
*/
|
|
85
134
|
indexOfParticipant(did: string): number;
|
|
86
135
|
addUpdate(participantDid: string, signedUpdate: SignedBTCR2Update): void;
|
|
136
|
+
/**
|
|
137
|
+
* Record that a participant declined to submit an update this round
|
|
138
|
+
* (cooperative non-inclusion). The member stays in the cohort and still signs.
|
|
139
|
+
*/
|
|
140
|
+
addNonInclusion(participantDid: string): void;
|
|
87
141
|
hasAllUpdates(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* True when every participant has responded for this round, either with an
|
|
144
|
+
* update or with an explicit non-inclusion. This is the aggregation gate when
|
|
145
|
+
* non-inclusion is in play; it generalizes {@link hasAllUpdates} the same way
|
|
146
|
+
* {@link hasAllValidationResponses} generalizes a unanimous ack.
|
|
147
|
+
*/
|
|
148
|
+
hasAllResponses(): boolean;
|
|
88
149
|
/**
|
|
89
150
|
* Builds a CAS Announcement Map from collected updates.
|
|
90
|
-
* Maps each participant DID
|
|
151
|
+
* Maps each participant DID to base64url canonical hash of their signed update.
|
|
91
152
|
* Computes signal bytes as SHA-256 of canonicalized announcement.
|
|
153
|
+
*
|
|
154
|
+
* Members who declined (cooperative non-inclusion) are naturally absent from
|
|
155
|
+
* the map: the body iterates {@link pendingUpdates}, which never holds a
|
|
156
|
+
* decliner. Absence from the map is exactly the CAS non-inclusion signal.
|
|
92
157
|
*/
|
|
93
158
|
buildCASAnnouncement(): CASAnnouncement;
|
|
94
159
|
/**
|
|
95
|
-
* Builds an SMT tree
|
|
96
|
-
*
|
|
97
|
-
*
|
|
160
|
+
* Builds an SMT tree with one leaf per participant.
|
|
161
|
+
*
|
|
162
|
+
* A member who submitted an update gets an inclusion leaf
|
|
163
|
+
* (SHA-256(SHA-256(nonce) || SHA-256(update))); a member who declined gets a
|
|
164
|
+
* non-inclusion leaf (SHA-256(SHA-256(nonce)), the `signedUpdate` entry field
|
|
165
|
+
* omitted). The cohort mints each member's nonce and returns it inside that
|
|
166
|
+
* member's serialized proof, so a decliner can self-validate its own
|
|
167
|
+
* non-inclusion slot and the resolver can recompute the leaf. Stores
|
|
168
|
+
* per-participant proofs and the SMT root as signalBytes.
|
|
98
169
|
*/
|
|
99
170
|
buildSMTTree(): Map<string, SerializedSMTProof>;
|
|
100
171
|
addValidation(participantDid: string, approved: boolean): void;
|
|
@@ -103,7 +174,7 @@ export declare class AggregationCohort {
|
|
|
103
174
|
*/
|
|
104
175
|
hasAllValidationResponses(): boolean;
|
|
105
176
|
/**
|
|
106
|
-
* True when all participants approved. Note: differs from {@link hasAllValidationResponses}
|
|
177
|
+
* True when all participants approved. Note: differs from {@link hasAllValidationResponses},
|
|
107
178
|
* this returns false if any participant rejected, even if all responses are in.
|
|
108
179
|
*/
|
|
109
180
|
isFullyValidated(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohort.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/cohort.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAa,MAAM,gBAAgB,CAAC;AAMpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cohort.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/cohort.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAa,MAAM,gB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AE,iBAAiB,GAAG,IAAI;IAU/E;;;OAGG;IACI,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAkB7C,aAAa,IAAI,OAAO;IAI/B;;;;;OAKG;IACI,eAAe,IAAI,OAAO;IAIjC;;;;;;;;OAQG;IACI,oBAAoB,IAAI,eAAe;IAgB9C;;;;;;;;;;OAUG;IACI,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAkC/C,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAcrE;;OAEG;IACI,yBAAyB,IAAI,OAAO;IAI3C;;;OAGG;IACI,gBAAgB,IAAI,OAAO;CAInC"}
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
* conditions are advertised metadata only - the protocol performs no payment or
|
|
15
15
|
* settlement (consistent with ADR 008).
|
|
16
16
|
*/
|
|
17
|
+
import type { FundingModel } from './recovery-policy.js';
|
|
17
18
|
/** Beacon types that support aggregation (singleton is single-party only, per ADR 037). */
|
|
18
19
|
export declare const KNOWN_BEACON_TYPES: readonly ["CASBeacon", "SMTBeacon"];
|
|
20
|
+
/** Funding models an operator may advertise. Only 'operator-funded' is implemented (ADR 042). */
|
|
21
|
+
export declare const KNOWN_FUNDING_MODELS: readonly ["operator-funded", "participant-funded"];
|
|
19
22
|
/**
|
|
20
23
|
* An advertised price. `unit` is operator-defined (the spec does not specify a
|
|
21
24
|
* currency); `basis` distinguishes a per-DID from a per-participant charge for
|
|
@@ -48,6 +51,31 @@ export interface CohortConditions {
|
|
|
48
51
|
maxSecondsBetweenAnnouncements?: number;
|
|
49
52
|
/** 7. Pending-update count that triggers an announcement. Advertised; enforcement staged (AGG-5) - generalizes hasAllUpdates(). */
|
|
50
53
|
pendingUpdateTrigger?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Who funds the beacon UTXO and holds the recovery path. Defaults to
|
|
56
|
+
* 'operator-funded' when absent. See ADR 042.
|
|
57
|
+
*/
|
|
58
|
+
fundingModel?: FundingModel;
|
|
59
|
+
/**
|
|
60
|
+
* Operator recovery key, x-only (64-character hex / 32 bytes). The beacon
|
|
61
|
+
* output commits to a CSV recovery leaf keyed to this key, so a missing signer
|
|
62
|
+
* can never permanently lock the funded UTXO. Required (ADR 042).
|
|
63
|
+
*/
|
|
64
|
+
recoveryKey: string;
|
|
65
|
+
/**
|
|
66
|
+
* Relative-timelock (BIP-68 nSequence, in blocks) before the recovery leaf is
|
|
67
|
+
* spendable. Required, >= 1 (ADR 042).
|
|
68
|
+
*/
|
|
69
|
+
recoverySequence: number;
|
|
70
|
+
/**
|
|
71
|
+
* Number of signers (k) the k-of-n fallback leaf requires, so any k cohort
|
|
72
|
+
* members can still announce when the optimistic n-of-n key path stalls
|
|
73
|
+
* (graceful liveness, ADR 042). Optional: when absent it defaults to n-1 at
|
|
74
|
+
* keygen, where n is the finalized participant count. When advertised it must
|
|
75
|
+
* be an integer >= 1 (and <= maxParticipants when that is set); the upper bound
|
|
76
|
+
* against the actual cohort size n is enforced at keygen.
|
|
77
|
+
*/
|
|
78
|
+
fallbackThreshold?: number;
|
|
51
79
|
}
|
|
52
80
|
/**
|
|
53
81
|
* Validate a set of cohort conditions. Returns a list of human-readable problems
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/conditions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,qCAAsC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAC;CACvC;AAED,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,e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AC;IAC9B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,kGAAkG;IAClG,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,+HAA+H;IAC/H,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,mIAAmI;IACnI,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AA6BD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAqDtE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback spend builder for aggregate beacon outputs.
|
|
3
|
+
*
|
|
4
|
+
* An aggregate beacon UTXO is a Taproot output whose key path is the cohort's
|
|
5
|
+
* n-of-n MuSig2 aggregate key and whose script path carries a k-of-n fallback
|
|
6
|
+
* leaf (`p2tr_ms` CHECKSIGADD) plus a CSV recovery leaf (see
|
|
7
|
+
* {@link ./recovery-policy.ts} and ADR 042). When the optimistic n-of-n key path
|
|
8
|
+
* stalls (a missing or defecting signer), the cohort can still push the SAME
|
|
9
|
+
* announcement transaction through the fallback leaf with any k members'
|
|
10
|
+
* signatures, instead of abandoning the round or waiting out the recovery
|
|
11
|
+
* timelock.
|
|
12
|
+
*
|
|
13
|
+
* Unlike the MuSig2 key path, the fallback is a plain k-of-n script-path spend:
|
|
14
|
+
* each signer produces a standalone BIP-340 signature over the script-path
|
|
15
|
+
* sighash (no nonce round), and the coordinator assembles k of them into the
|
|
16
|
+
* witness. The coordinator never holds a participant secret - it injects the
|
|
17
|
+
* collected signatures and finalizes.
|
|
18
|
+
*
|
|
19
|
+
* This module is pure with respect to the network: it takes the beacon
|
|
20
|
+
* transaction, the cohort and recovery parameters, the spent output, and the
|
|
21
|
+
* collected signatures, and returns a finalized {@link Transaction}.
|
|
22
|
+
* Broadcasting is the caller's concern.
|
|
23
|
+
*/
|
|
24
|
+
import type { Transaction } from '@scure/btc-signer';
|
|
25
|
+
import type { FundingModel } from './recovery-policy.js';
|
|
26
|
+
/** A single member's standalone signature over the fallback script-path sighash. */
|
|
27
|
+
export interface FallbackSignature {
|
|
28
|
+
/** Signer's x-only public key (32 bytes). Must be one of the cohort's keys. */
|
|
29
|
+
pubKey: Uint8Array;
|
|
30
|
+
/** 64-byte BIP-340 Schnorr signature over the script-path sighash. */
|
|
31
|
+
signature: Uint8Array;
|
|
32
|
+
}
|
|
33
|
+
/** Inputs to {@link buildFallbackSpend}. */
|
|
34
|
+
export interface FallbackSpendParams {
|
|
35
|
+
/**
|
|
36
|
+
* The beacon announcement transaction to finalize. Input {@link inputIndex}
|
|
37
|
+
* spends the beacon UTXO; its key-path witness must not be set (the fallback
|
|
38
|
+
* assembles a script-path witness instead).
|
|
39
|
+
*/
|
|
40
|
+
pendingTx: Transaction;
|
|
41
|
+
/** Index of the beacon input within {@link pendingTx}. Defaults to 0. */
|
|
42
|
+
inputIndex?: number;
|
|
43
|
+
/**
|
|
44
|
+
* The cohort's participant public keys (compressed secp256k1, 33 bytes).
|
|
45
|
+
* Sorted internally per BIP-327 so the reconstructed tree matches the funded
|
|
46
|
+
* output.
|
|
47
|
+
*/
|
|
48
|
+
cohortKeys: Uint8Array[];
|
|
49
|
+
/**
|
|
50
|
+
* The advertised k of the k-of-n fallback leaf, or omit for the cohort's n-1
|
|
51
|
+
* default. Resolved against `cohortKeys.length` exactly as the cohort does.
|
|
52
|
+
*/
|
|
53
|
+
fallbackThreshold?: number;
|
|
54
|
+
/** Operator recovery key, x-only (32 bytes). Needed to reconstruct the script tree. */
|
|
55
|
+
recoveryKey: Uint8Array;
|
|
56
|
+
/** Relative-timelock (BIP-68) the recovery leaf enforces. Needed to reconstruct the script tree. */
|
|
57
|
+
recoverySequence: number;
|
|
58
|
+
/** Funding model governing the leaves. Defaults to 'operator-funded'. */
|
|
59
|
+
fundingModel?: FundingModel;
|
|
60
|
+
/** Bitcoin network name (bitcoin/mainnet, mutinynet, signet, testnet, regtest). */
|
|
61
|
+
network: string;
|
|
62
|
+
/** scriptPubKey of the beacon UTXO being spent. Must equal the reconstructed tree output script. */
|
|
63
|
+
prevOutScript: Uint8Array;
|
|
64
|
+
/** Value of the beacon UTXO in satoshis. */
|
|
65
|
+
prevOutValue: bigint;
|
|
66
|
+
/**
|
|
67
|
+
* Standalone signatures collected from cohort members. At least
|
|
68
|
+
* {@link fallbackThreshold} valid, distinct-by-key signatures are required;
|
|
69
|
+
* exactly k are injected (a k-of-n CHECKSIGADD leaf demands exactly k).
|
|
70
|
+
*/
|
|
71
|
+
signatures: FallbackSignature[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Compute the BIP-341 script-path sighash a cohort member must sign to authorize
|
|
75
|
+
* the fallback spend. The leaf is the k-of-n fallback leaf; signers produce a
|
|
76
|
+
* standalone BIP-340 signature over this digest with SIGHASH_DEFAULT.
|
|
77
|
+
*/
|
|
78
|
+
export declare function fallbackSighash(tx: Transaction, inputIndex: number, prevOutScript: Uint8Array, prevOutValue: bigint, fallbackLeafScript: Uint8Array): Uint8Array;
|
|
79
|
+
/**
|
|
80
|
+
* Assemble and finalize a k-of-n fallback spend of an aggregate beacon UTXO.
|
|
81
|
+
*
|
|
82
|
+
* Reconstructs the funded Taproot output (MuSig2 internal key + fallback/recovery
|
|
83
|
+
* script tree), verifies each collected signature against the script-path
|
|
84
|
+
* sighash and a cohort key, injects exactly k distinct valid signatures into the
|
|
85
|
+
* fallback leaf, and finalizes the witness. The returned transaction is the same
|
|
86
|
+
* announcement the optimistic path would have produced, signed via the script
|
|
87
|
+
* path instead of the key path.
|
|
88
|
+
*
|
|
89
|
+
* @throws {AggregationCohortError} when there are no cohort keys, the spent
|
|
90
|
+
* script does not match the reconstructed tree output, or fewer than k valid
|
|
91
|
+
* distinct signatures were supplied.
|
|
92
|
+
*/
|
|
93
|
+
export declare function buildFallbackSpend(params: FallbackSpendParams): Transaction;
|
|
94
|
+
//# sourceMappingURL=fallback-spend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback-spend.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/fallback-spend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAIpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAUzD,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,MAAM,EAAE,UAAU,CAAC;IACnB,sEAAsE;IACtE,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,SAAS,EAAE,WAAW,CAAC;IACvB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,WAAW,EAAE,UAAU,CAAC;IACxB,oGAAoG;IACpG,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,aAAa,EAAE,UAAU,CAAC;IAC1B,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,WAAW,EACf,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,UAAU,EACzB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,UAAU,GAC7B,UAAU,CAUZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,WAAW,CA4F3E"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* {@link SILENT_LOGGER} to suppress output (useful for tests) or a custom
|
|
7
7
|
* implementation to route logs to pino, winston, Sentry, etc.
|
|
8
8
|
*
|
|
9
|
-
* The interface is intentionally small
|
|
9
|
+
* The interface is intentionally small: we don't want production code taking
|
|
10
10
|
* a hard dependency on any specific logger library.
|
|
11
11
|
*/
|
|
12
12
|
export interface Logger {
|
|
@@ -17,6 +17,12 @@ export type BaseBody = Partial<CohortConditions> & {
|
|
|
17
17
|
aggregatedNonce?: Uint8Array;
|
|
18
18
|
nonceContribution?: Uint8Array;
|
|
19
19
|
partialSignature?: Uint8Array;
|
|
20
|
+
/** Fallback (k-of-n script-path) leaf script, hex. Carried on FALLBACK_AUTHORIZATION_REQUEST. */
|
|
21
|
+
fallbackLeafScriptHex?: string;
|
|
22
|
+
/** Signer's x-only key for a fallback signature (which CHECKSIGADD slot it satisfies). */
|
|
23
|
+
signerPk?: Uint8Array;
|
|
24
|
+
/** A member's standalone BIP-340 fallback script-path signature (64 bytes). */
|
|
25
|
+
fallbackSignature?: Uint8Array;
|
|
20
26
|
pendingTx?: string;
|
|
21
27
|
/** Hex-encoded scriptPubKey of the UTXO being spent. Required for BIP-341 sighash. */
|
|
22
28
|
prevOutScriptHex?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,IAA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C,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,qBAAa,WAAW;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;gBAEX,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI;IAQnD;;;OAGG;IACI,MAAM,IAAI,IAAI;CAStB"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import type { SerializedSMTProof } from '@did-btcr2/smt';
|
|
14
14
|
import type { CohortConditions } from '../conditions.js';
|
|
15
15
|
import type { BaseMessage } from './base.js';
|
|
16
|
-
import { AGGREGATED_NONCE, AUTHORIZATION_REQUEST, COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY, DISTRIBUTE_AGGREGATED_DATA, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_UPDATE, VALIDATION_ACK } from './constants.js';
|
|
16
|
+
import { AGGREGATED_NONCE, AUTHORIZATION_REQUEST, COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY, DISTRIBUTE_AGGREGATED_DATA, FALLBACK_AUTHORIZATION_REQUEST, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK } from './constants.js';
|
|
17
17
|
export interface CohortAdvertBody extends CohortConditions {
|
|
18
18
|
cohortId: string;
|
|
19
19
|
network: string;
|
|
@@ -36,6 +36,14 @@ export interface SubmitUpdateBody {
|
|
|
36
36
|
cohortId: string;
|
|
37
37
|
signedUpdate: Record<string, unknown>;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* A member declines to submit an update this round (cooperative non-inclusion).
|
|
41
|
+
* Carries only the cohortId; membership is proven by the signed transport
|
|
42
|
+
* envelope (the sender DID), so no payload is needed.
|
|
43
|
+
*/
|
|
44
|
+
export interface SubmitNonIncludedBody {
|
|
45
|
+
cohortId: string;
|
|
46
|
+
}
|
|
39
47
|
export interface DistributeAggregatedDataBody {
|
|
40
48
|
cohortId: string;
|
|
41
49
|
beaconType: string;
|
|
@@ -69,6 +77,31 @@ export interface SignatureAuthorizationBody {
|
|
|
69
77
|
sessionId: string;
|
|
70
78
|
partialSignature: Uint8Array;
|
|
71
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Service asks members to authorize the k-of-n fallback (script-path) spend of
|
|
82
|
+
* the SAME beacon transaction (ADR 042). Carries the unsigned tx and the spent
|
|
83
|
+
* output so each member recomputes the script-path sighash itself. The fallback
|
|
84
|
+
* leaf script is included for cross-check; members recompute it from their own
|
|
85
|
+
* cohort state.
|
|
86
|
+
*/
|
|
87
|
+
export interface FallbackAuthorizationRequestBody {
|
|
88
|
+
cohortId: string;
|
|
89
|
+
sessionId: string;
|
|
90
|
+
pendingTx: string;
|
|
91
|
+
prevOutScriptHex: string;
|
|
92
|
+
prevOutValue: string;
|
|
93
|
+
fallbackLeafScriptHex: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A member's standalone BIP-340 signature over the fallback script-path sighash.
|
|
97
|
+
* `signerPk` is the member's x-only key (which CHECKSIGADD slot it satisfies).
|
|
98
|
+
*/
|
|
99
|
+
export interface FallbackSignatureBody {
|
|
100
|
+
cohortId: string;
|
|
101
|
+
sessionId: string;
|
|
102
|
+
signerPk: Uint8Array;
|
|
103
|
+
fallbackSignature: Uint8Array;
|
|
104
|
+
}
|
|
72
105
|
export type CohortAdvertMessage = BaseMessage & {
|
|
73
106
|
type: typeof COHORT_ADVERT;
|
|
74
107
|
body: CohortAdvertBody;
|
|
@@ -89,6 +122,10 @@ export type SubmitUpdateMessage = BaseMessage & {
|
|
|
89
122
|
type: typeof SUBMIT_UPDATE;
|
|
90
123
|
body: SubmitUpdateBody;
|
|
91
124
|
};
|
|
125
|
+
export type SubmitNonIncludedMessage = BaseMessage & {
|
|
126
|
+
type: typeof SUBMIT_NONINCLUDED;
|
|
127
|
+
body: SubmitNonIncludedBody;
|
|
128
|
+
};
|
|
92
129
|
export type DistributeAggregatedDataMessage = BaseMessage & {
|
|
93
130
|
type: typeof DISTRIBUTE_AGGREGATED_DATA;
|
|
94
131
|
body: DistributeAggregatedDataBody;
|
|
@@ -113,17 +150,28 @@ export type SignatureAuthorizationMessage = BaseMessage & {
|
|
|
113
150
|
type: typeof SIGNATURE_AUTHORIZATION;
|
|
114
151
|
body: SignatureAuthorizationBody;
|
|
115
152
|
};
|
|
153
|
+
export type FallbackAuthorizationRequestMessage = BaseMessage & {
|
|
154
|
+
type: typeof FALLBACK_AUTHORIZATION_REQUEST;
|
|
155
|
+
body: FallbackAuthorizationRequestBody;
|
|
156
|
+
};
|
|
157
|
+
export type FallbackSignatureMessage = BaseMessage & {
|
|
158
|
+
type: typeof FALLBACK_SIGNATURE;
|
|
159
|
+
body: FallbackSignatureBody;
|
|
160
|
+
};
|
|
116
161
|
/** Discriminated union of every well-formed aggregation message. */
|
|
117
|
-
export type AggregationMessage = CohortAdvertMessage | CohortOptInMessage | CohortOptInAcceptMessage | CohortReadyMessage | SubmitUpdateMessage | DistributeAggregatedDataMessage | ValidationAckMessage | AuthorizationRequestMessage | NonceContributionMessage | AggregatedNonceMessage | SignatureAuthorizationMessage;
|
|
162
|
+
export type AggregationMessage = CohortAdvertMessage | CohortOptInMessage | CohortOptInAcceptMessage | CohortReadyMessage | SubmitUpdateMessage | SubmitNonIncludedMessage | DistributeAggregatedDataMessage | ValidationAckMessage | AuthorizationRequestMessage | NonceContributionMessage | AggregatedNonceMessage | SignatureAuthorizationMessage | FallbackAuthorizationRequestMessage | FallbackSignatureMessage;
|
|
118
163
|
export declare function isCohortAdvertMessage(m: BaseMessage): m is CohortAdvertMessage;
|
|
119
164
|
export declare function isCohortOptInMessage(m: BaseMessage): m is CohortOptInMessage;
|
|
120
165
|
export declare function isCohortOptInAcceptMessage(m: BaseMessage): m is CohortOptInAcceptMessage;
|
|
121
166
|
export declare function isCohortReadyMessage(m: BaseMessage): m is CohortReadyMessage;
|
|
122
167
|
export declare function isSubmitUpdateMessage(m: BaseMessage): m is SubmitUpdateMessage;
|
|
168
|
+
export declare function isSubmitNonIncludedMessage(m: BaseMessage): m is SubmitNonIncludedMessage;
|
|
123
169
|
export declare function isDistributeAggregatedDataMessage(m: BaseMessage): m is DistributeAggregatedDataMessage;
|
|
124
170
|
export declare function isValidationAckMessage(m: BaseMessage): m is ValidationAckMessage;
|
|
125
171
|
export declare function isAuthorizationRequestMessage(m: BaseMessage): m is AuthorizationRequestMessage;
|
|
126
172
|
export declare function isNonceContributionMessage(m: BaseMessage): m is NonceContributionMessage;
|
|
127
173
|
export declare function isAggregatedNonceMessage(m: BaseMessage): m is AggregatedNonceMessage;
|
|
128
174
|
export declare function isSignatureAuthorizationMessage(m: BaseMessage): m is SignatureAuthorizationMessage;
|
|
175
|
+
export declare function isFallbackAuthorizationRequestMessage(m: BaseMessage): m is FallbackAuthorizationRequestMessage;
|
|
176
|
+
export declare function isFallbackSignatureMessage(m: BaseMessage): m is FallbackSignatureMessage;
|
|
129
177
|
//# sourceMappingURL=bodies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bodies.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/bodies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"bodies.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/bodies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,EAC1B,8BAA8B,EAC9B,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACf,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;IAC1B,eAAe,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,UA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
|
10
|
+
* - Step 4 fallback (k-of-n script path, ADR 042): FALLBACK_AUTHORIZATION_REQUEST,
|
|
11
|
+
* FALLBACK_SIGNATURE
|
|
10
12
|
*/
|
|
11
13
|
export declare const AGGREGATION_MESSAGE_PREFIX = "https://btcr2.dev/aggregation";
|
|
12
14
|
export declare const COHORT_ADVERT = "https://btcr2.dev/aggregation/keygen/cohort_advert";
|
|
@@ -14,10 +16,16 @@ export declare const COHORT_OPT_IN = "https://btcr2.dev/aggregation/keygen/cohor
|
|
|
14
16
|
export declare const COHORT_OPT_IN_ACCEPT = "https://btcr2.dev/aggregation/keygen/cohort_opt_in_accept";
|
|
15
17
|
export declare const COHORT_READY = "https://btcr2.dev/aggregation/keygen/cohort_ready";
|
|
16
18
|
export declare const SUBMIT_UPDATE = "https://btcr2.dev/aggregation/update/submit_update";
|
|
19
|
+
/** A member with no update this round declines explicitly (cooperative non-inclusion). */
|
|
20
|
+
export declare const SUBMIT_NONINCLUDED = "https://btcr2.dev/aggregation/update/submit_nonincluded";
|
|
17
21
|
export declare const DISTRIBUTE_AGGREGATED_DATA = "https://btcr2.dev/aggregation/update/distribute_aggregated_data";
|
|
18
22
|
export declare const VALIDATION_ACK = "https://btcr2.dev/aggregation/update/validation_ack";
|
|
19
23
|
export declare const AUTHORIZATION_REQUEST = "https://btcr2.dev/aggregation/sign/authorization_request";
|
|
20
24
|
export declare const NONCE_CONTRIBUTION = "https://btcr2.dev/aggregation/sign/nonce_contribution";
|
|
21
25
|
export declare const AGGREGATED_NONCE = "https://btcr2.dev/aggregation/sign/aggregated_nonce";
|
|
22
26
|
export declare const SIGNATURE_AUTHORIZATION = "https://btcr2.dev/aggregation/sign/signature_authorization";
|
|
27
|
+
/** Service asks members to sign the fallback (k-of-n) script path of the beacon tx. */
|
|
28
|
+
export declare const FALLBACK_AUTHORIZATION_REQUEST = "https://btcr2.dev/aggregation/sign/fallback_authorization_request";
|
|
29
|
+
/** A member returns a standalone BIP-340 signature over the fallback script-path sighash. */
|
|
30
|
+
export declare const FALLBACK_SIGNATURE = "https://btcr2.dev/aggregation/sign/fallback_signature";
|
|
23
31
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/constants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,kCAAkC,CAAC;AAG1E,eAAO,MAAM,aAAa,uDAAuD,CAAC;AAClF,eAAO,MAAM,aAAa,uDAAuD,CAAC;AAClF,eAAO,MAAM,oBAAoB,8DAA8D,CAAC;AAChG,eAAO,MAAM,YAAY,sDAAsD,CAAC;AAGhF,eAAO,MAAM,aAAa,uDAAuD,CAAC;AAClF,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,4DAA4D,CAAC;AAC5F,eAAO,MAAM,0BAA0B,oEAAoE,CAAC;AAC5G,eAAO,MAAM,cAAc,wDAAwD,CAAC;AAGpF,eAAO,MAAM,qBAAqB,6DAA6D,CAAC;AAChG,eAAO,MAAM,kBAAkB,0DAA0D,CAAC;AAC1F,eAAO,MAAM,gBAAgB,wDAAwD,CAAC;AACtF,eAAO,MAAM,uBAAuB,+DAA+D,CAAC;AAKpG,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,sEAAsE,CAAC;AAClH,6FAA6F;AAC7F,eAAO,MAAM,kBAAkB,0DAA0D,CAAC"}
|
|
@@ -66,6 +66,17 @@ type SubmitUpdateMessage = {
|
|
|
66
66
|
* @returns {BaseMessage} The created Submit Update message.
|
|
67
67
|
*/
|
|
68
68
|
export declare function createSubmitUpdateMessage(fields: SubmitUpdateMessage): BaseMessage;
|
|
69
|
+
type SubmitNonIncludedMessage = {
|
|
70
|
+
from: string;
|
|
71
|
+
to: string;
|
|
72
|
+
cohortId: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Factory for a Submit Non-Included message: a member declares it has no update
|
|
76
|
+
* this round (cooperative non-inclusion). Membership is proven by the signed
|
|
77
|
+
* envelope, so the body carries only the cohortId.
|
|
78
|
+
*/
|
|
79
|
+
export declare function createSubmitNonIncludedMessage(fields: SubmitNonIncludedMessage): BaseMessage;
|
|
69
80
|
/**
|
|
70
81
|
* Step 3: Aggregate & Validate
|
|
71
82
|
* Factory functions for creating messages related to the aggregate and validate step, where
|
|
@@ -173,5 +184,34 @@ export declare function createAggregatedNonceMessage(fields: AggregatedNonceMess
|
|
|
173
184
|
* @returns {BaseMessage} The created Signature Authorization message.
|
|
174
185
|
*/
|
|
175
186
|
export declare function createSignatureAuthorizationMessage(fields: SignatureAuthorizationMessage): BaseMessage;
|
|
187
|
+
type FallbackAuthorizationRequestMessage = {
|
|
188
|
+
from: string;
|
|
189
|
+
to: string;
|
|
190
|
+
cohortId: string;
|
|
191
|
+
sessionId: string;
|
|
192
|
+
pendingTx: string;
|
|
193
|
+
prevOutScriptHex: string;
|
|
194
|
+
prevOutValue: string;
|
|
195
|
+
fallbackLeafScriptHex: string;
|
|
196
|
+
};
|
|
197
|
+
type FallbackSignatureMessage = {
|
|
198
|
+
from: string;
|
|
199
|
+
to: string;
|
|
200
|
+
cohortId: string;
|
|
201
|
+
sessionId: string;
|
|
202
|
+
signerPk: Uint8Array;
|
|
203
|
+
fallbackSignature: Uint8Array;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Factory for a Fallback Authorization Request: the service asks members to
|
|
207
|
+
* authorize the k-of-n script-path spend of the beacon transaction when the
|
|
208
|
+
* optimistic n-of-n key path stalls (ADR 042).
|
|
209
|
+
*/
|
|
210
|
+
export declare function createFallbackAuthorizationRequestMessage(fields: FallbackAuthorizationRequestMessage): BaseMessage;
|
|
211
|
+
/**
|
|
212
|
+
* Factory for a Fallback Signature: a member's standalone BIP-340 signature over
|
|
213
|
+
* the fallback script-path sighash (no nonce round).
|
|
214
|
+
*/
|
|
215
|
+
export declare function createFallbackSignatureMessage(fields: FallbackSignatureMessage): BaseMessage;
|
|
176
216
|
export {};
|
|
177
217
|
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAkBxC;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,gBAAgB,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,UAAU,CAAC;CAC7B,CAAC;AACF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;IAC1B,eAAe,EAAE,UAAU,CAAC;CAC7B,CAAC;AACF,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC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;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,wBAAwB,GAAG,WAAW,CAG5F;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,sBAAsB,GAAG,WAAW,CAGxF;AAED;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,6BAA6B,GAAG,WAAW,CAGtG;AAED,KAAK,mCAAmC,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AACF,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,UAAU,CAAC;IACrB,iBAAiB,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yCAAyC,CAAC,MAAM,EAAE,mCAAmC,GAAG,WAAW,CAGlH;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,wBAAwB,GAAG,WAAW,CAG5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/guards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/messages/guards.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,8DAA8D;AAC9D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,8DAA8D;AAC9D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD"}
|