@did-btcr2/method 0.36.1 → 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 +1060 -96
- package/dist/browser.mjs +1060 -96
- package/dist/cjs/index.js +1153 -179
- 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 +210 -21
- 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 +74 -22
- package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
- package/dist/esm/core/aggregation/runner/service-runner.js +97 -9
- 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 +41 -7
- 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 +28 -7
- package/dist/types/core/aggregation/runner/events.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/participant-runner.d.ts +3 -3
- package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/service-runner.d.ts +28 -3
- 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 +255 -23
- 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 +26 -7
- package/src/core/aggregation/runner/participant-runner.ts +75 -23
- package/src/core/aggregation/runner/service-runner.ts +120 -10
- 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
|
@@ -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,IAAI,CAAC;AAK1C,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OA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@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,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,WAAW,GAAG,CAAC,IAAI,6BAA6B,CAKlG;AAED,wBAAgB,qCAAqC,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,IAAI,mCAAmC,CAQ9G;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,IAAI,wBAAwB,CAMxF"}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* - Step 3 (Aggregate & Validate): DISTRIBUTE_AGGREGATED_DATA, VALIDATION_ACK
|
|
8
8
|
* - Step 4 (Sign & Broadcast): AUTHORIZATION_REQUEST, NONCE_CONTRIBUTION,
|
|
9
9
|
* AGGREGATED_NONCE, SIGNATURE_AUTHORIZATION
|
|
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,I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mC,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"}
|
|
@@ -15,7 +15,7 @@ export interface CohortAdvert extends CohortConditions {
|
|
|
15
15
|
network: string;
|
|
16
16
|
serviceCommunicationPk: Uint8Array;
|
|
17
17
|
}
|
|
18
|
-
/** Joined cohort info
|
|
18
|
+
/** Joined cohort info, available after the cohort is finalized. */
|
|
19
19
|
export interface JoinedCohortInfo {
|
|
20
20
|
cohortId: string;
|
|
21
21
|
serviceDid: string;
|
|
@@ -29,8 +29,11 @@ export interface PendingValidation {
|
|
|
29
29
|
signalBytesHex: string;
|
|
30
30
|
casAnnouncement?: Record<string, string>;
|
|
31
31
|
smtProof?: SerializedSMTProof;
|
|
32
|
+
/** Canonical hash of this participant's update; empty for a decliner. */
|
|
32
33
|
expectedHash: string;
|
|
33
34
|
matches: boolean;
|
|
35
|
+
/** True if this participant submitted an update; false if it declined (non-inclusion). */
|
|
36
|
+
included: boolean;
|
|
34
37
|
}
|
|
35
38
|
/** Pending signing request (UI: review tx for approval). */
|
|
36
39
|
export interface PendingSigningRequest {
|
|
@@ -41,6 +44,20 @@ export interface PendingSigningRequest {
|
|
|
41
44
|
prevOutScriptHex: string;
|
|
42
45
|
prevOutValue: string;
|
|
43
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Pending fallback signing request (UI: review the fallback spend for approval).
|
|
49
|
+
* The service fell back to the k-of-n script path; the member signs the SAME
|
|
50
|
+
* beacon transaction over the fallback script-path sighash (ADR 042).
|
|
51
|
+
*/
|
|
52
|
+
export interface PendingFallbackRequest {
|
|
53
|
+
cohortId: string;
|
|
54
|
+
sessionId: string;
|
|
55
|
+
pendingTxHex: string;
|
|
56
|
+
prevOutScriptHex: string;
|
|
57
|
+
prevOutValue: string;
|
|
58
|
+
/** Fallback leaf script, hex (advisory; the member recomputes it from its own cohort). */
|
|
59
|
+
fallbackLeafScriptHex: string;
|
|
60
|
+
}
|
|
44
61
|
export interface AggregationParticipantParams {
|
|
45
62
|
did: string;
|
|
46
63
|
/**
|
|
@@ -68,7 +85,7 @@ export declare class AggregationParticipant {
|
|
|
68
85
|
get publicKey(): Uint8Array;
|
|
69
86
|
/**
|
|
70
87
|
* Process an incoming message. Updates internal state but never produces
|
|
71
|
-
* outgoing messages
|
|
88
|
+
* outgoing messages: those come exclusively from action methods.
|
|
72
89
|
*/
|
|
73
90
|
receive(message: BaseMessage): void;
|
|
74
91
|
/** Cohorts the participant has discovered but not yet joined. */
|
|
@@ -78,21 +95,28 @@ export declare class AggregationParticipant {
|
|
|
78
95
|
* Returns the opt-in message to send.
|
|
79
96
|
*/
|
|
80
97
|
joinCohort(cohortId: string): BaseMessage[];
|
|
81
|
-
/** Cohorts that have been finalized
|
|
98
|
+
/** Cohorts that have been finalized: beacon address available. */
|
|
82
99
|
get joinedCohorts(): ReadonlyMap<string, JoinedCohortInfo>;
|
|
83
100
|
/**
|
|
84
101
|
* User action: submit a signed BTCR2 update for inclusion in the cohort's
|
|
85
102
|
* aggregated signal.
|
|
86
103
|
*/
|
|
87
104
|
submitUpdate(cohortId: string, signedUpdate: SignedBTCR2Update): BaseMessage[];
|
|
105
|
+
/**
|
|
106
|
+
* User action: decline to submit an update this round (cooperative
|
|
107
|
+
* non-inclusion). The member stays in the cohort and still signs; it will be
|
|
108
|
+
* absent from the CAS Announcement Map, or carry a non-inclusion leaf in the
|
|
109
|
+
* SMT. Returns the SUBMIT_NONINCLUDED message to send.
|
|
110
|
+
*/
|
|
111
|
+
declineUpdate(cohortId: string): BaseMessage[];
|
|
88
112
|
/** Aggregated data awaiting user validation. */
|
|
89
113
|
get pendingValidations(): ReadonlyMap<string, PendingValidation>;
|
|
90
114
|
/**
|
|
91
115
|
* The validated aggregated data retained for a cohort, regardless of phase.
|
|
92
116
|
* Unlike {@link pendingValidations} (which lists only cohorts still awaiting
|
|
93
|
-
* the validate decision), this returns the stored validation
|
|
94
|
-
* participant's sidecar (the CAS Announcement map or its SMT inclusion proof)
|
|
95
|
-
*
|
|
117
|
+
* the validate decision), this returns the stored validation, including the
|
|
118
|
+
* participant's sidecar (the CAS Announcement map or its SMT inclusion proof),
|
|
119
|
+
* so it is still readable once the cohort reaches Complete. Returns
|
|
96
120
|
* undefined before aggregated data has been received.
|
|
97
121
|
*/
|
|
98
122
|
getValidation(cohortId: string): PendingValidation | undefined;
|
|
@@ -112,10 +136,20 @@ export declare class AggregationParticipant {
|
|
|
112
136
|
approveNonce(cohortId: string): BaseMessage[];
|
|
113
137
|
/**
|
|
114
138
|
* User action: generate and return the partial signature.
|
|
115
|
-
* In most UIs this is automatic after AwaitingPartialSig
|
|
139
|
+
* In most UIs this is automatic after AwaitingPartialSig, but exposing it
|
|
116
140
|
* as an explicit action lets the client UI confirm before signing if desired.
|
|
117
141
|
*/
|
|
118
142
|
generatePartialSignature(cohortId: string): BaseMessage[];
|
|
143
|
+
/** Fallback signing requests awaiting user approval (UI: review the fallback spend). */
|
|
144
|
+
get pendingFallbackRequests(): ReadonlyMap<string, PendingFallbackRequest>;
|
|
145
|
+
/**
|
|
146
|
+
* User action: authorize the fallback spend. Recomputes the k-of-n fallback
|
|
147
|
+
* leaf from the member's OWN cohort state (not the service-provided script),
|
|
148
|
+
* computes the BIP-341 script-path sighash over the requested transaction, and
|
|
149
|
+
* returns a standalone BIP-340 signature (no nonce round). The member completes
|
|
150
|
+
* once it has contributed; the service needs only k of these.
|
|
151
|
+
*/
|
|
152
|
+
approveFallback(cohortId: string): BaseMessage[];
|
|
119
153
|
getCohortPhase(cohortId: string): ParticipantCohortPhaseType | undefined;
|
|
120
154
|
/**
|
|
121
155
|
* Zeroize any retained MuSig2 secret nonces across all cohorts. The raw
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/participant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/participant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAMxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAqBtD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA2BrD;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED,mEA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AE,MAAM,GAAG,WAAW,EAAE;IA8ChD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS;IAI/E;;;;;OAKG;IACI,YAAY,IAAI,IAAI;CAK5B"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* The signing session has its own phase enum because MuSig2 signing is a
|
|
9
9
|
* sub-protocol within the larger aggregation protocol.
|
|
10
10
|
*/
|
|
11
|
-
export type ServiceCohortPhaseType = 'Created' | 'Advertised' | 'CohortSet' | 'CollectingUpdates' | 'UpdatesCollected' | 'DataDistributed' | 'Validated' | 'SigningStarted' | 'NoncesCollected' | 'AwaitingPartialSigs' | 'Complete' | 'Failed';
|
|
11
|
+
export type ServiceCohortPhaseType = 'Created' | 'Advertised' | 'CohortSet' | 'CollectingUpdates' | 'UpdatesCollected' | 'DataDistributed' | 'Validated' | 'SigningStarted' | 'NoncesCollected' | 'AwaitingPartialSigs' | 'FallbackRequested' | 'Complete' | 'Failed';
|
|
12
12
|
export declare enum ServiceCohortPhase {
|
|
13
13
|
Created = "Created",
|
|
14
14
|
Advertised = "Advertised",
|
|
@@ -20,20 +20,26 @@ export declare enum ServiceCohortPhase {
|
|
|
20
20
|
SigningStarted = "SigningStarted",
|
|
21
21
|
NoncesCollected = "NoncesCollected",
|
|
22
22
|
AwaitingPartialSigs = "AwaitingPartialSigs",
|
|
23
|
+
/** Optimistic n-of-n key path abandoned; collecting k-of-n fallback signatures (ADR 042). */
|
|
24
|
+
FallbackRequested = "FallbackRequested",
|
|
23
25
|
Complete = "Complete",
|
|
24
26
|
Failed = "Failed"
|
|
25
27
|
}
|
|
26
|
-
export type ParticipantCohortPhaseType = 'Discovered' | 'OptedIn' | 'CohortReady' | 'UpdateSubmitted' | 'AwaitingValidation' | 'ValidationSent' | 'AwaitingSigning' | 'NonceSent' | 'AwaitingPartialSig' | 'Complete' | 'Failed';
|
|
28
|
+
export type ParticipantCohortPhaseType = 'Discovered' | 'OptedIn' | 'CohortReady' | 'UpdateSubmitted' | 'NonIncluded' | 'AwaitingValidation' | 'ValidationSent' | 'AwaitingSigning' | 'NonceSent' | 'AwaitingPartialSig' | 'AwaitingFallbackSig' | 'Complete' | 'Failed';
|
|
27
29
|
export declare enum ParticipantCohortPhase {
|
|
28
30
|
Discovered = "Discovered",
|
|
29
31
|
OptedIn = "OptedIn",
|
|
30
32
|
CohortReady = "CohortReady",
|
|
31
33
|
UpdateSubmitted = "UpdateSubmitted",
|
|
34
|
+
/** Member declined to submit an update this round (cooperative non-inclusion); still signs. */
|
|
35
|
+
NonIncluded = "NonIncluded",
|
|
32
36
|
AwaitingValidation = "AwaitingValidation",
|
|
33
37
|
ValidationSent = "ValidationSent",
|
|
34
38
|
AwaitingSigning = "AwaitingSigning",
|
|
35
39
|
NonceSent = "NonceSent",
|
|
36
40
|
AwaitingPartialSig = "AwaitingPartialSig",
|
|
41
|
+
/** Service fell back to the k-of-n script path; member can sign the fallback (ADR 042). */
|
|
42
|
+
AwaitingFallbackSig = "AwaitingFallbackSig",
|
|
37
43
|
Complete = "Complete",
|
|
38
44
|
Failed = "Failed"
|
|
39
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,YAAY,GACZ,WAAW,GACX,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,qBAAqB,GACrB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAClC,YAAY,GACZ,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,sBAAsB;IAChC,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,uBAAuB,GAC/B,4BAA4B,GAC5B,4BAA4B,GAC5B,2BAA2B,GAC3B,2BAA2B,GAC3B,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,mBAAmB;IAC7B,0BAA0B,+BAA+B;IACzD,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB"}
|
|
1
|
+
{"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,YAAY,GACZ,WAAW,GACX,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,6FAA6F;IAC7F,iBAAiB,sBAAsB;IACvC,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAClC,YAAY,GACZ,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,qBAAqB,GACrB,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,sBAAsB;IAChC,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,+FAA+F;IAC/F,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,SAAS,cAAc;IACvB,kBAAkB,uBAAuB;IACzC,2FAA2F;IAC3F,mBAAmB,wBAAwB;IAC3C,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,uBAAuB,GAC/B,4BAA4B,GAC5B,4BAA4B,GAC5B,2BAA2B,GAC3B,2BAA2B,GAC3B,UAAU,GACV,QAAQ,CAAC;AAEb,oBAAY,mBAAmB;IAC7B,0BAA0B,+BAA+B;IACzD,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recovery policy 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. A key-path-only output can be spent only with a
|
|
6
|
+
* signature from every cohort member, so a single missing signer would lock the
|
|
7
|
+
* funds forever. To prevent that, the output commits to a script tree with two
|
|
8
|
+
* leaves:
|
|
9
|
+
* - a k-of-n fallback leaf (`p2tr_ms`, BIP-342 CHECKSIGADD): any k cohort members
|
|
10
|
+
* can still push the announcement through if some signers go missing, so the
|
|
11
|
+
* beacon stays live without waiting out the timelock.
|
|
12
|
+
* - a CSV recovery leaf: after a relative-timelock delay the funder can reclaim
|
|
13
|
+
* the UTXO unilaterally with its own recovery key, so funds are never
|
|
14
|
+
* permanently stranded even if fewer than k members remain.
|
|
15
|
+
*
|
|
16
|
+
* This module is the seam between the funding model and the concrete script
|
|
17
|
+
* leaves. Only `operator-funded` is implemented today (the k-of-n fallback leaf
|
|
18
|
+
* plus one CSV leaf keyed to the operator's recovery key). A future
|
|
19
|
+
* `participant-funded` model can be added as another case returning
|
|
20
|
+
* per-participant refund leaves, without touching the cohort, service, or
|
|
21
|
+
* signing code. See ADR 042.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Who funds the beacon UTXO and holds the recovery path.
|
|
25
|
+
* - `operator-funded`: the service operator funds the UTXO and holds a single
|
|
26
|
+
* CSV recovery key. Implemented.
|
|
27
|
+
* - `participant-funded`: reserved for per-participant funding with
|
|
28
|
+
* per-participant refund leaves. Not implemented.
|
|
29
|
+
*/
|
|
30
|
+
export type FundingModel = 'operator-funded' | 'participant-funded';
|
|
31
|
+
/** Default funding model when an advert/config leaves it unspecified. */
|
|
32
|
+
export declare const DEFAULT_FUNDING_MODEL: FundingModel;
|
|
33
|
+
/**
|
|
34
|
+
* Default relative-timelock (in blocks) before operator recovery is spendable.
|
|
35
|
+
* About one day at 10-minute blocks. Operators set their own per-cohort value;
|
|
36
|
+
* this is only a convenience default for callers.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEFAULT_RECOVERY_SEQUENCE = 144;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum allowed `recoverySequence`, 0xffff (65535 blocks, about 455 days).
|
|
41
|
+
*
|
|
42
|
+
* The value is a BIP-68 block-based relative timelock and is placed directly in
|
|
43
|
+
* the spending input's nSequence. BIP-68 only uses the low 16 bits as the value
|
|
44
|
+
* when the type flag (bit 22) is clear, so constraining to [1, 0xffff] keeps the
|
|
45
|
+
* timelock block-based and, critically, leaves the disable flag (bit 31) clear.
|
|
46
|
+
* A value with bit 31 set would disable CHECKSEQUENCEVERIFY entirely, letting the
|
|
47
|
+
* recovery key spend with no delay; an upper bound of 0xffff makes that
|
|
48
|
+
* unrepresentable.
|
|
49
|
+
*/
|
|
50
|
+
export declare const MAX_RECOVERY_SEQUENCE = 65535;
|
|
51
|
+
/** Inputs needed to build the CSV recovery leaf. */
|
|
52
|
+
export interface RecoveryPolicyParams {
|
|
53
|
+
/** Operator recovery key, x-only (32 bytes). Spends the recovery leaf via CHECKSIG. */
|
|
54
|
+
recoveryKey: Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
* Relative-timelock value (BIP-68 nSequence) the recovery spend must wait,
|
|
57
|
+
* encoded into the leaf as `<recoverySequence> CHECKSEQUENCEVERIFY`.
|
|
58
|
+
*/
|
|
59
|
+
recoverySequence: number;
|
|
60
|
+
}
|
|
61
|
+
/** Inputs needed to build the k-of-n fallback leaf. */
|
|
62
|
+
export interface FallbackPolicyParams {
|
|
63
|
+
/**
|
|
64
|
+
* The cohort's participant public keys (compressed secp256k1, 33 bytes each).
|
|
65
|
+
* Sorted internally per BIP-327 and reduced to x-only so the leaf is
|
|
66
|
+
* deterministic regardless of the order keys are supplied in.
|
|
67
|
+
*/
|
|
68
|
+
cohortKeys: Uint8Array[];
|
|
69
|
+
/**
|
|
70
|
+
* Number of signers (k) the fallback leaf requires, 1..n. This is the
|
|
71
|
+
* resolved threshold; callers that carry an advertised-or-default value should
|
|
72
|
+
* resolve it with {@link resolveFallbackThreshold} first.
|
|
73
|
+
*/
|
|
74
|
+
fallbackThreshold: number;
|
|
75
|
+
}
|
|
76
|
+
/** All inputs the beacon output's script tree commits to (fallback leaf + recovery leaf). */
|
|
77
|
+
export interface BeaconLeafParams extends RecoveryPolicyParams, FallbackPolicyParams {
|
|
78
|
+
}
|
|
79
|
+
/** A single Taproot script-tree leaf, spent at the default tapscript leaf version (0xc0). */
|
|
80
|
+
export interface TaprootScriptLeaf {
|
|
81
|
+
script: Uint8Array;
|
|
82
|
+
}
|
|
83
|
+
/** BIP-341 default tapscript leaf version. */
|
|
84
|
+
export declare const TAPROOT_LEAF_VERSION = 192;
|
|
85
|
+
/**
|
|
86
|
+
* BIP-341 tapleaf hash: `taggedHash("TapLeaf", leafVersion || compactSize(len) || script)`.
|
|
87
|
+
* Used to key a script-path signature to its leaf when assembling the witness
|
|
88
|
+
* for a script-path spend (the fallback and recovery spend builders).
|
|
89
|
+
*/
|
|
90
|
+
export declare function tapLeafHash(script: Uint8Array, leafVersion?: number): Uint8Array;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve the effective fallback threshold k from an advertised value and the
|
|
93
|
+
* cohort size n. When unadvertised it defaults to n-1 (tolerate one missing or
|
|
94
|
+
* defecting signer, the cheapest useful fallback witness), floored at 1. Both
|
|
95
|
+
* the service and every participant resolve this identically so they derive the
|
|
96
|
+
* same beacon address.
|
|
97
|
+
*/
|
|
98
|
+
export declare function resolveFallbackThreshold(advertised: number | undefined, n: number): number;
|
|
99
|
+
/**
|
|
100
|
+
* Build the k-of-n fallback leaf script: a BIP-342 `p2tr_ms` CHECKSIGADD
|
|
101
|
+
* multisig over the cohort's x-only keys. Any k members can spend this leaf to
|
|
102
|
+
* push the announcement through when the optimistic n-of-n key path stalls.
|
|
103
|
+
*
|
|
104
|
+
* The keys are sorted per BIP-327 (matching the MuSig2 internal-key ordering)
|
|
105
|
+
* and reduced to x-only, so the leaf is identical for every party that builds it.
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildFallbackLeaf(params: FallbackPolicyParams): Uint8Array;
|
|
108
|
+
/**
|
|
109
|
+
* Build the CSV recovery leaf script:
|
|
110
|
+
* `<recoverySequence> CHECKSEQUENCEVERIFY DROP <recoveryKey> CHECKSIG`.
|
|
111
|
+
*
|
|
112
|
+
* After `recoverySequence` blocks (relative to the UTXO's confirmation) the
|
|
113
|
+
* holder of `recoveryKey` can spend the output via the script path.
|
|
114
|
+
*/
|
|
115
|
+
export declare function buildRecoveryScript(params: RecoveryPolicyParams): Uint8Array;
|
|
116
|
+
/**
|
|
117
|
+
* Build the Taproot script-tree leaves for a funding model. The returned leaves
|
|
118
|
+
* are the script tree the beacon output key commits to alongside the cohort's
|
|
119
|
+
* MuSig2 internal key.
|
|
120
|
+
*
|
|
121
|
+
* Canonical leaf order is fallback (k-of-n, leaf A) then CSV recovery (leaf B).
|
|
122
|
+
* For the current two-leaf tree the Merkle root is order-invariant (a TapBranch
|
|
123
|
+
* sorts its two child hashes), but fixing the order keeps the construction
|
|
124
|
+
* deterministic and reviewable, and is consensus-affecting should the tree ever
|
|
125
|
+
* grow past two leaves.
|
|
126
|
+
*
|
|
127
|
+
* @throws {AggregationCohortError} when the funding model is reserved (e.g.
|
|
128
|
+
* `participant-funded`) or unknown, or when the fallback/recovery params are
|
|
129
|
+
* invalid.
|
|
130
|
+
*/
|
|
131
|
+
export declare function buildRecoveryLeaves(fundingModel: FundingModel, params: BeaconLeafParams): TaprootScriptLeaf[];
|
|
132
|
+
//# sourceMappingURL=recovery-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery-policy.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/recovery-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAQH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAEpE,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,EAAE,YAAgC,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,uFAAuF;IACv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