@did-btcr2/aggregation 0.1.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/LICENSE +373 -0
- package/README.md +19 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/browser.js +24017 -0
- package/dist/browser.mjs +24011 -0
- package/dist/cjs/index.js +5690 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/beacon-strategy.js +76 -0
- package/dist/esm/beacon-strategy.js.map +1 -0
- package/dist/esm/cohort.js +316 -0
- package/dist/esm/cohort.js.map +1 -0
- package/dist/esm/conditions.js +102 -0
- package/dist/esm/conditions.js.map +1 -0
- package/dist/esm/errors.js +22 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/fallback-spend.js +132 -0
- package/dist/esm/fallback-spend.js.map +1 -0
- package/dist/esm/index.js +21 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.js +15 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/messages/base.js +36 -0
- package/dist/esm/messages/base.js.map +1 -0
- package/dist/esm/messages/bodies.js +149 -0
- package/dist/esm/messages/bodies.js.map +1 -0
- package/dist/esm/messages/constants.js +37 -0
- package/dist/esm/messages/constants.js.map +1 -0
- package/dist/esm/messages/factories.js +139 -0
- package/dist/esm/messages/factories.js.map +1 -0
- package/dist/esm/messages/guards.js +40 -0
- package/dist/esm/messages/guards.js.map +1 -0
- package/dist/esm/messages/index.js +6 -0
- package/dist/esm/messages/index.js.map +1 -0
- package/dist/esm/participant.js +588 -0
- package/dist/esm/participant.js.map +1 -0
- package/dist/esm/phases.js +45 -0
- package/dist/esm/phases.js.map +1 -0
- package/dist/esm/recovery-policy.js +156 -0
- package/dist/esm/recovery-policy.js.map +1 -0
- package/dist/esm/recovery-spend.js +106 -0
- package/dist/esm/recovery-spend.js.map +1 -0
- package/dist/esm/runner/aggregation-runner.js +75 -0
- package/dist/esm/runner/aggregation-runner.js.map +1 -0
- package/dist/esm/runner/events.js +2 -0
- package/dist/esm/runner/events.js.map +1 -0
- package/dist/esm/runner/index.js +6 -0
- package/dist/esm/runner/index.js.map +1 -0
- package/dist/esm/runner/participant-runner.js +407 -0
- package/dist/esm/runner/participant-runner.js.map +1 -0
- package/dist/esm/runner/service-runner.js +701 -0
- package/dist/esm/runner/service-runner.js.map +1 -0
- package/dist/esm/runner/typed-emitter.js +80 -0
- package/dist/esm/runner/typed-emitter.js.map +1 -0
- package/dist/esm/service.js +774 -0
- package/dist/esm/service.js.map +1 -0
- package/dist/esm/signer.js +33 -0
- package/dist/esm/signer.js.map +1 -0
- package/dist/esm/signing-session.js +195 -0
- package/dist/esm/signing-session.js.map +1 -0
- package/dist/esm/transport/didcomm.js +41 -0
- package/dist/esm/transport/didcomm.js.map +1 -0
- package/dist/esm/transport/error.js +12 -0
- package/dist/esm/transport/error.js.map +1 -0
- package/dist/esm/transport/factory.js +29 -0
- package/dist/esm/transport/factory.js.map +1 -0
- package/dist/esm/transport/http/client.js +342 -0
- package/dist/esm/transport/http/client.js.map +1 -0
- package/dist/esm/transport/http/envelope.js +126 -0
- package/dist/esm/transport/http/envelope.js.map +1 -0
- package/dist/esm/transport/http/errors.js +11 -0
- package/dist/esm/transport/http/errors.js.map +1 -0
- package/dist/esm/transport/http/inbox-buffer.js +45 -0
- package/dist/esm/transport/http/inbox-buffer.js.map +1 -0
- package/dist/esm/transport/http/index.js +12 -0
- package/dist/esm/transport/http/index.js.map +1 -0
- package/dist/esm/transport/http/nonce-cache.js +38 -0
- package/dist/esm/transport/http/nonce-cache.js.map +1 -0
- package/dist/esm/transport/http/protocol.js +28 -0
- package/dist/esm/transport/http/protocol.js.map +1 -0
- package/dist/esm/transport/http/rate-limiter.js +45 -0
- package/dist/esm/transport/http/rate-limiter.js.map +1 -0
- package/dist/esm/transport/http/request-auth.js +100 -0
- package/dist/esm/transport/http/request-auth.js.map +1 -0
- package/dist/esm/transport/http/server.js +475 -0
- package/dist/esm/transport/http/server.js.map +1 -0
- package/dist/esm/transport/http/sse-stream.js +110 -0
- package/dist/esm/transport/http/sse-stream.js.map +1 -0
- package/dist/esm/transport/http/sse-writer.js +25 -0
- package/dist/esm/transport/http/sse-writer.js.map +1 -0
- package/dist/esm/transport/in-memory.js +149 -0
- package/dist/esm/transport/in-memory.js.map +1 -0
- package/dist/esm/transport/index.js +8 -0
- package/dist/esm/transport/index.js.map +1 -0
- package/dist/esm/transport/nostr.js +491 -0
- package/dist/esm/transport/nostr.js.map +1 -0
- package/dist/esm/transport/transport.js +2 -0
- package/dist/esm/transport/transport.js.map +1 -0
- package/dist/types/beacon-strategy.d.ts +56 -0
- package/dist/types/beacon-strategy.d.ts.map +1 -0
- package/dist/types/cohort.d.ts +188 -0
- package/dist/types/cohort.d.ts.map +1 -0
- package/dist/types/conditions.d.ts +86 -0
- package/dist/types/conditions.d.ts.map +1 -0
- package/dist/types/errors.d.ts +14 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/fallback-spend.d.ts +94 -0
- package/dist/types/fallback-spend.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/logger.d.ts +22 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/messages/base.d.ts +58 -0
- package/dist/types/messages/base.d.ts.map +1 -0
- package/dist/types/messages/bodies.d.ts +177 -0
- package/dist/types/messages/bodies.d.ts.map +1 -0
- package/dist/types/messages/constants.d.ts +31 -0
- package/dist/types/messages/constants.d.ts.map +1 -0
- package/dist/types/messages/factories.d.ts +217 -0
- package/dist/types/messages/factories.d.ts.map +1 -0
- package/dist/types/messages/guards.d.ts +11 -0
- package/dist/types/messages/guards.d.ts.map +1 -0
- package/dist/types/messages/index.d.ts +6 -0
- package/dist/types/messages/index.d.ts.map +1 -0
- package/dist/types/participant.d.ts +162 -0
- package/dist/types/participant.d.ts.map +1 -0
- package/dist/types/phases.d.ts +55 -0
- package/dist/types/phases.d.ts.map +1 -0
- package/dist/types/recovery-policy.d.ts +132 -0
- package/dist/types/recovery-policy.d.ts.map +1 -0
- package/dist/types/recovery-spend.d.ts +94 -0
- package/dist/types/recovery-spend.d.ts.map +1 -0
- package/dist/types/runner/aggregation-runner.d.ts +72 -0
- package/dist/types/runner/aggregation-runner.d.ts.map +1 -0
- package/dist/types/runner/events.d.ts +147 -0
- package/dist/types/runner/events.d.ts.map +1 -0
- package/dist/types/runner/index.d.ts +6 -0
- package/dist/types/runner/index.d.ts.map +1 -0
- package/dist/types/runner/participant-runner.d.ts +122 -0
- package/dist/types/runner/participant-runner.d.ts.map +1 -0
- package/dist/types/runner/service-runner.d.ts +228 -0
- package/dist/types/runner/service-runner.d.ts.map +1 -0
- package/dist/types/runner/typed-emitter.d.ts +41 -0
- package/dist/types/runner/typed-emitter.d.ts.map +1 -0
- package/dist/types/service.d.ts +177 -0
- package/dist/types/service.d.ts.map +1 -0
- package/dist/types/signer.d.ts +50 -0
- package/dist/types/signer.d.ts.map +1 -0
- package/dist/types/signing-session.d.ts +81 -0
- package/dist/types/signing-session.d.ts.map +1 -0
- package/dist/types/transport/didcomm.d.ts +23 -0
- package/dist/types/transport/didcomm.d.ts.map +1 -0
- package/dist/types/transport/error.d.ts +8 -0
- package/dist/types/transport/error.d.ts.map +1 -0
- package/dist/types/transport/factory.d.ts +28 -0
- package/dist/types/transport/factory.d.ts.map +1 -0
- package/dist/types/transport/http/client.d.ts +56 -0
- package/dist/types/transport/http/client.d.ts.map +1 -0
- package/dist/types/transport/http/envelope.d.ts +64 -0
- package/dist/types/transport/http/envelope.d.ts.map +1 -0
- package/dist/types/transport/http/errors.d.ts +9 -0
- package/dist/types/transport/http/errors.d.ts.map +1 -0
- package/dist/types/transport/http/inbox-buffer.d.ts +32 -0
- package/dist/types/transport/http/inbox-buffer.d.ts.map +1 -0
- package/dist/types/transport/http/index.d.ts +12 -0
- package/dist/types/transport/http/index.d.ts.map +1 -0
- package/dist/types/transport/http/nonce-cache.d.ts +26 -0
- package/dist/types/transport/http/nonce-cache.d.ts.map +1 -0
- package/dist/types/transport/http/protocol.d.ts +53 -0
- package/dist/types/transport/http/protocol.d.ts.map +1 -0
- package/dist/types/transport/http/rate-limiter.d.ts +41 -0
- package/dist/types/transport/http/rate-limiter.d.ts.map +1 -0
- package/dist/types/transport/http/request-auth.d.ts +50 -0
- package/dist/types/transport/http/request-auth.d.ts.map +1 -0
- package/dist/types/transport/http/server.d.ts +118 -0
- package/dist/types/transport/http/server.d.ts.map +1 -0
- package/dist/types/transport/http/sse-stream.d.ts +34 -0
- package/dist/types/transport/http/sse-stream.d.ts.map +1 -0
- package/dist/types/transport/http/sse-writer.d.ts +12 -0
- package/dist/types/transport/http/sse-writer.d.ts.map +1 -0
- package/dist/types/transport/in-memory.d.ts +64 -0
- package/dist/types/transport/in-memory.d.ts.map +1 -0
- package/dist/types/transport/index.d.ts +8 -0
- package/dist/types/transport/index.d.ts.map +1 -0
- package/dist/types/transport/nostr.d.ts +153 -0
- package/dist/types/transport/nostr.d.ts.map +1 -0
- package/dist/types/transport/transport.d.ts +62 -0
- package/dist/types/transport/transport.d.ts.map +1 -0
- package/package.json +128 -0
- package/src/beacon-strategy.ts +142 -0
- package/src/cohort.ts +422 -0
- package/src/conditions.ts +172 -0
- package/src/errors.ts +25 -0
- package/src/fallback-spend.ts +223 -0
- package/src/index.ts +23 -0
- package/src/logger.ts +33 -0
- package/src/messages/base.ts +80 -0
- package/src/messages/bodies.ts +328 -0
- package/src/messages/constants.ts +40 -0
- package/src/messages/factories.ts +297 -0
- package/src/messages/guards.ts +61 -0
- package/src/messages/index.ts +5 -0
- package/src/participant.ts +779 -0
- package/src/phases.ts +91 -0
- package/src/recovery-policy.ts +237 -0
- package/src/recovery-spend.ts +192 -0
- package/src/runner/aggregation-runner.ts +125 -0
- package/src/runner/events.ts +129 -0
- package/src/runner/index.ts +5 -0
- package/src/runner/participant-runner.ts +488 -0
- package/src/runner/service-runner.ts +891 -0
- package/src/runner/typed-emitter.ts +87 -0
- package/src/service.ts +1000 -0
- package/src/signer.ts +67 -0
- package/src/signing-session.ts +290 -0
- package/src/transport/didcomm.ts +59 -0
- package/src/transport/error.ts +13 -0
- package/src/transport/factory.ts +65 -0
- package/src/transport/http/client.ts +409 -0
- package/src/transport/http/envelope.ts +204 -0
- package/src/transport/http/errors.ts +11 -0
- package/src/transport/http/inbox-buffer.ts +53 -0
- package/src/transport/http/index.ts +11 -0
- package/src/transport/http/nonce-cache.ts +43 -0
- package/src/transport/http/protocol.ts +57 -0
- package/src/transport/http/rate-limiter.ts +75 -0
- package/src/transport/http/request-auth.ts +164 -0
- package/src/transport/http/server.ts +617 -0
- package/src/transport/http/sse-stream.ts +121 -0
- package/src/transport/http/sse-writer.ts +23 -0
- package/src/transport/in-memory.ts +178 -0
- package/src/transport/index.ts +7 -0
- package/src/transport/nostr.ts +576 -0
- package/src/transport/transport.ts +79 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-message-type body interfaces and a discriminated {@link AggregationMessage}
|
|
3
|
+
* union.
|
|
4
|
+
*
|
|
5
|
+
* {@link BaseBody} remains the superset-of-all-fields body type used by the
|
|
6
|
+
* raw {@link BaseMessage} class (see `base.ts`). The narrow interfaces here
|
|
7
|
+
* describe what each specific message type is *required* to carry and are
|
|
8
|
+
* exposed alongside type guards for consumers who want compile-time narrowing.
|
|
9
|
+
*
|
|
10
|
+
* Guards validate both `type` and the presence of required body fields so they
|
|
11
|
+
* are safe to use on messages that have round-tripped through JSON / a relay.
|
|
12
|
+
*/
|
|
13
|
+
import type { SerializedSMTProof } from '@did-btcr2/smt';
|
|
14
|
+
import type { CohortConditions } from '../conditions.js';
|
|
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, FALLBACK_AUTHORIZATION_REQUEST, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK } from './constants.js';
|
|
17
|
+
export interface CohortAdvertBody extends CohortConditions {
|
|
18
|
+
cohortId: string;
|
|
19
|
+
network: string;
|
|
20
|
+
communicationPk: Uint8Array;
|
|
21
|
+
}
|
|
22
|
+
export interface CohortOptInBody {
|
|
23
|
+
cohortId: string;
|
|
24
|
+
participantPk: Uint8Array;
|
|
25
|
+
communicationPk: Uint8Array;
|
|
26
|
+
}
|
|
27
|
+
export interface CohortOptInAcceptBody {
|
|
28
|
+
cohortId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CohortReadyBody {
|
|
31
|
+
cohortId: string;
|
|
32
|
+
beaconAddress: string;
|
|
33
|
+
cohortKeys: Array<Uint8Array>;
|
|
34
|
+
}
|
|
35
|
+
export interface SubmitUpdateBody {
|
|
36
|
+
cohortId: string;
|
|
37
|
+
signedUpdate: Record<string, unknown>;
|
|
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
|
+
}
|
|
47
|
+
export interface DistributeAggregatedDataBody {
|
|
48
|
+
cohortId: string;
|
|
49
|
+
beaconType: string;
|
|
50
|
+
signalBytesHex: string;
|
|
51
|
+
casAnnouncement?: Record<string, string>;
|
|
52
|
+
smtProof?: Record<string, unknown> | SerializedSMTProof;
|
|
53
|
+
}
|
|
54
|
+
export interface ValidationAckBody {
|
|
55
|
+
cohortId: string;
|
|
56
|
+
approved: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface AuthorizationRequestBody {
|
|
59
|
+
cohortId: string;
|
|
60
|
+
sessionId: string;
|
|
61
|
+
pendingTx: string;
|
|
62
|
+
prevOutScriptHex: string;
|
|
63
|
+
prevOutValue: string;
|
|
64
|
+
}
|
|
65
|
+
export interface NonceContributionBody {
|
|
66
|
+
cohortId: string;
|
|
67
|
+
sessionId: string;
|
|
68
|
+
nonceContribution: Uint8Array;
|
|
69
|
+
}
|
|
70
|
+
export interface AggregatedNonceBody {
|
|
71
|
+
cohortId: string;
|
|
72
|
+
sessionId: string;
|
|
73
|
+
aggregatedNonce: Uint8Array;
|
|
74
|
+
}
|
|
75
|
+
export interface SignatureAuthorizationBody {
|
|
76
|
+
cohortId: string;
|
|
77
|
+
sessionId: string;
|
|
78
|
+
partialSignature: Uint8Array;
|
|
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
|
+
}
|
|
105
|
+
export type CohortAdvertMessage = BaseMessage & {
|
|
106
|
+
type: typeof COHORT_ADVERT;
|
|
107
|
+
body: CohortAdvertBody;
|
|
108
|
+
};
|
|
109
|
+
export type CohortOptInMessage = BaseMessage & {
|
|
110
|
+
type: typeof COHORT_OPT_IN;
|
|
111
|
+
body: CohortOptInBody;
|
|
112
|
+
};
|
|
113
|
+
export type CohortOptInAcceptMessage = BaseMessage & {
|
|
114
|
+
type: typeof COHORT_OPT_IN_ACCEPT;
|
|
115
|
+
body: CohortOptInAcceptBody;
|
|
116
|
+
};
|
|
117
|
+
export type CohortReadyMessage = BaseMessage & {
|
|
118
|
+
type: typeof COHORT_READY;
|
|
119
|
+
body: CohortReadyBody;
|
|
120
|
+
};
|
|
121
|
+
export type SubmitUpdateMessage = BaseMessage & {
|
|
122
|
+
type: typeof SUBMIT_UPDATE;
|
|
123
|
+
body: SubmitUpdateBody;
|
|
124
|
+
};
|
|
125
|
+
export type SubmitNonIncludedMessage = BaseMessage & {
|
|
126
|
+
type: typeof SUBMIT_NONINCLUDED;
|
|
127
|
+
body: SubmitNonIncludedBody;
|
|
128
|
+
};
|
|
129
|
+
export type DistributeAggregatedDataMessage = BaseMessage & {
|
|
130
|
+
type: typeof DISTRIBUTE_AGGREGATED_DATA;
|
|
131
|
+
body: DistributeAggregatedDataBody;
|
|
132
|
+
};
|
|
133
|
+
export type ValidationAckMessage = BaseMessage & {
|
|
134
|
+
type: typeof VALIDATION_ACK;
|
|
135
|
+
body: ValidationAckBody;
|
|
136
|
+
};
|
|
137
|
+
export type AuthorizationRequestMessage = BaseMessage & {
|
|
138
|
+
type: typeof AUTHORIZATION_REQUEST;
|
|
139
|
+
body: AuthorizationRequestBody;
|
|
140
|
+
};
|
|
141
|
+
export type NonceContributionMessage = BaseMessage & {
|
|
142
|
+
type: typeof NONCE_CONTRIBUTION;
|
|
143
|
+
body: NonceContributionBody;
|
|
144
|
+
};
|
|
145
|
+
export type AggregatedNonceMessage = BaseMessage & {
|
|
146
|
+
type: typeof AGGREGATED_NONCE;
|
|
147
|
+
body: AggregatedNonceBody;
|
|
148
|
+
};
|
|
149
|
+
export type SignatureAuthorizationMessage = BaseMessage & {
|
|
150
|
+
type: typeof SIGNATURE_AUTHORIZATION;
|
|
151
|
+
body: SignatureAuthorizationBody;
|
|
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
|
+
};
|
|
161
|
+
/** Discriminated union of every well-formed aggregation message. */
|
|
162
|
+
export type AggregationMessage = CohortAdvertMessage | CohortOptInMessage | CohortOptInAcceptMessage | CohortReadyMessage | SubmitUpdateMessage | SubmitNonIncludedMessage | DistributeAggregatedDataMessage | ValidationAckMessage | AuthorizationRequestMessage | NonceContributionMessage | AggregatedNonceMessage | SignatureAuthorizationMessage | FallbackAuthorizationRequestMessage | FallbackSignatureMessage;
|
|
163
|
+
export declare function isCohortAdvertMessage(m: BaseMessage): m is CohortAdvertMessage;
|
|
164
|
+
export declare function isCohortOptInMessage(m: BaseMessage): m is CohortOptInMessage;
|
|
165
|
+
export declare function isCohortOptInAcceptMessage(m: BaseMessage): m is CohortOptInAcceptMessage;
|
|
166
|
+
export declare function isCohortReadyMessage(m: BaseMessage): m is CohortReadyMessage;
|
|
167
|
+
export declare function isSubmitUpdateMessage(m: BaseMessage): m is SubmitUpdateMessage;
|
|
168
|
+
export declare function isSubmitNonIncludedMessage(m: BaseMessage): m is SubmitNonIncludedMessage;
|
|
169
|
+
export declare function isDistributeAggregatedDataMessage(m: BaseMessage): m is DistributeAggregatedDataMessage;
|
|
170
|
+
export declare function isValidationAckMessage(m: BaseMessage): m is ValidationAckMessage;
|
|
171
|
+
export declare function isAuthorizationRequestMessage(m: BaseMessage): m is AuthorizationRequestMessage;
|
|
172
|
+
export declare function isNonceContributionMessage(m: BaseMessage): m is NonceContributionMessage;
|
|
173
|
+
export declare function isAggregatedNonceMessage(m: BaseMessage): m is AggregatedNonceMessage;
|
|
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;
|
|
177
|
+
//# sourceMappingURL=bodies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodies.d.ts","sourceRoot":"","sources":["../../../src/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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ons/aggregate-beacons.html):
|
|
5
|
+
* - Step 1 (Cohort Formation): COHORT_ADVERT, COHORT_OPT_IN, COHORT_OPT_IN_ACCEPT, COHORT_READY
|
|
6
|
+
* - Step 2 (Update Submission): SUBMIT_UPDATE
|
|
7
|
+
* - Step 3 (Aggregate & Validate): DISTRIBUTE_AGGREGATED_DATA, VALIDATION_ACK
|
|
8
|
+
* - Step 4 (Sign & Broadcast): AUTHORIZATION_REQUEST, NONCE_CONTRIBUTION,
|
|
9
|
+
* AGGREGATED_NONCE, SIGNATURE_AUTHORIZATION
|
|
10
|
+
* - Step 4 fallback (k-of-n script path, ADR 042): FALLBACK_AUTHORIZATION_REQUEST,
|
|
11
|
+
* FALLBACK_SIGNATURE
|
|
12
|
+
*/
|
|
13
|
+
export declare const AGGREGATION_MESSAGE_PREFIX = "https://btcr2.dev/aggregation";
|
|
14
|
+
export declare const COHORT_ADVERT = "https://btcr2.dev/aggregation/keygen/cohort_advert";
|
|
15
|
+
export declare const COHORT_OPT_IN = "https://btcr2.dev/aggregation/keygen/cohort_opt_in";
|
|
16
|
+
export declare const COHORT_OPT_IN_ACCEPT = "https://btcr2.dev/aggregation/keygen/cohort_opt_in_accept";
|
|
17
|
+
export declare const COHORT_READY = "https://btcr2.dev/aggregation/keygen/cohort_ready";
|
|
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";
|
|
21
|
+
export declare const DISTRIBUTE_AGGREGATED_DATA = "https://btcr2.dev/aggregation/update/distribute_aggregated_data";
|
|
22
|
+
export declare const VALIDATION_ACK = "https://btcr2.dev/aggregation/update/validation_ack";
|
|
23
|
+
export declare const AUTHORIZATION_REQUEST = "https://btcr2.dev/aggregation/sign/authorization_request";
|
|
24
|
+
export declare const NONCE_CONTRIBUTION = "https://btcr2.dev/aggregation/sign/nonce_contribution";
|
|
25
|
+
export declare const AGGREGATED_NONCE = "https://btcr2.dev/aggregation/sign/aggregated_nonce";
|
|
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";
|
|
31
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/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"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { CohortConditions } from '../conditions.js';
|
|
2
|
+
import { BaseMessage } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Step 1: Cohort Formation
|
|
5
|
+
* Factory functions for creating messages related to the cohort formation step, where cohorts are
|
|
6
|
+
* formed and participants opt in to join the cohort.
|
|
7
|
+
*/
|
|
8
|
+
type CohortAdvertMessage = CohortConditions & {
|
|
9
|
+
from: string;
|
|
10
|
+
cohortId: string;
|
|
11
|
+
network: string;
|
|
12
|
+
communicationPk: Uint8Array;
|
|
13
|
+
};
|
|
14
|
+
type CohortOptInMessage = {
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
cohortId: string;
|
|
18
|
+
participantPk: Uint8Array;
|
|
19
|
+
communicationPk: Uint8Array;
|
|
20
|
+
};
|
|
21
|
+
type CohortOptInAcceptMessage = {
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
cohortId: string;
|
|
25
|
+
};
|
|
26
|
+
type CohortReadyMessage = {
|
|
27
|
+
from: string;
|
|
28
|
+
to: string;
|
|
29
|
+
cohortId: string;
|
|
30
|
+
beaconAddress: string;
|
|
31
|
+
cohortKeys: Array<Uint8Array>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Factory function for creating a Cohort Advert message, which is used to announce the formation of
|
|
35
|
+
* a new cohort and invite participants to join.
|
|
36
|
+
* @param {CohortAdvertMessage} fields - The fields required to create a Cohort Advert message.
|
|
37
|
+
* @returns {BaseMessage} The created Cohort Advert message.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createCohortAdvertMessage(fields: CohortAdvertMessage): BaseMessage;
|
|
40
|
+
/**
|
|
41
|
+
* Factory function for creating a Cohort Opt-In message, which is sent by a participant to express
|
|
42
|
+
* interest in joining a cohort.
|
|
43
|
+
* @param {CohortOptInMessage} fields - The fields required to create a Cohort Opt-In message, which
|
|
44
|
+
* is sent by a participant to express interest in joining a cohort.
|
|
45
|
+
* @returns {BaseMessage} The created Cohort Opt-In message.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createCohortOptInMessage(fields: CohortOptInMessage): BaseMessage;
|
|
48
|
+
export declare function createCohortOptInAcceptMessage(fields: CohortOptInAcceptMessage): BaseMessage;
|
|
49
|
+
export declare function createCohortReadyMessage(fields: CohortReadyMessage): BaseMessage;
|
|
50
|
+
/**
|
|
51
|
+
* Step 2: Update Submission
|
|
52
|
+
* Factory functions for creating messages related to the update submission step, where participants
|
|
53
|
+
* submit their signed updates for aggregation.
|
|
54
|
+
*/
|
|
55
|
+
type SubmitUpdateMessage = {
|
|
56
|
+
from: string;
|
|
57
|
+
to: string;
|
|
58
|
+
cohortId: string;
|
|
59
|
+
signedUpdate: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Factory function for creating a Submit Update message, which is sent by a participant to submit
|
|
63
|
+
* their signed update for aggregation.
|
|
64
|
+
* @param {SubmitUpdateMessage} fields - The fields required to create a Submit Update message,
|
|
65
|
+
* which is sent by a participant to submit their signed update for aggregation.
|
|
66
|
+
* @returns {BaseMessage} The created Submit Update message.
|
|
67
|
+
*/
|
|
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;
|
|
80
|
+
/**
|
|
81
|
+
* Step 3: Aggregate & Validate
|
|
82
|
+
* Factory functions for creating messages related to the aggregate and validate step, where
|
|
83
|
+
* participants aggregate their updates and validate the aggregated data.
|
|
84
|
+
*/
|
|
85
|
+
type DistributeAggregatedDataMessage = {
|
|
86
|
+
from: string;
|
|
87
|
+
to: string;
|
|
88
|
+
cohortId: string;
|
|
89
|
+
beaconType: string;
|
|
90
|
+
signalBytesHex: string;
|
|
91
|
+
casAnnouncement?: Record<string, string>;
|
|
92
|
+
smtProof?: Record<string, unknown>;
|
|
93
|
+
};
|
|
94
|
+
type ValidationAckMessage = {
|
|
95
|
+
from: string;
|
|
96
|
+
to: string;
|
|
97
|
+
cohortId: string;
|
|
98
|
+
approved: boolean;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Factory function for creating a Distribute Aggregated Data message, which is sent by the
|
|
102
|
+
* aggregator to distribute the aggregated data to participants for validation.
|
|
103
|
+
* @param {DistributeAggregatedDataMessage} fields - The fields required to create a Distribute
|
|
104
|
+
* Aggregated Data message, which is sent by the aggregator to distribute the aggregated data to
|
|
105
|
+
* participants for validation.
|
|
106
|
+
* @returns {BaseMessage} The created Distribute Aggregated Data message.
|
|
107
|
+
*/
|
|
108
|
+
export declare function createDistributeAggregatedDataMessage(fields: DistributeAggregatedDataMessage): BaseMessage;
|
|
109
|
+
/**
|
|
110
|
+
* Factory function for creating a Validation Acknowledgment message, which is sent by a participant
|
|
111
|
+
* to acknowledge.
|
|
112
|
+
* @param {ValidationAckMessage} fields - The fields required to create a Validation Acknowledgment
|
|
113
|
+
* message, which is sent by a participant to acknowledge the validation of the aggregated data.
|
|
114
|
+
* @returns {BaseMessage} The created Validation Acknowledgment message.
|
|
115
|
+
*/
|
|
116
|
+
export declare function createValidationAckMessage(fields: ValidationAckMessage): BaseMessage;
|
|
117
|
+
/**
|
|
118
|
+
* Step 4: Signing
|
|
119
|
+
* Factory functions for creating messages related to the signing step, where participants request
|
|
120
|
+
* signatures, contribute nonces, and authorize signatures.
|
|
121
|
+
*/
|
|
122
|
+
type AuthorizationRequestMessage = {
|
|
123
|
+
from: string;
|
|
124
|
+
to: string;
|
|
125
|
+
cohortId: string;
|
|
126
|
+
sessionId: string;
|
|
127
|
+
pendingTx: string;
|
|
128
|
+
prevOutScriptHex: string;
|
|
129
|
+
prevOutValue: string;
|
|
130
|
+
};
|
|
131
|
+
type NonceContributionMessage = {
|
|
132
|
+
from: string;
|
|
133
|
+
to: string;
|
|
134
|
+
cohortId: string;
|
|
135
|
+
sessionId: string;
|
|
136
|
+
nonceContribution: Uint8Array;
|
|
137
|
+
};
|
|
138
|
+
type AggregatedNonceMessage = {
|
|
139
|
+
from: string;
|
|
140
|
+
to: string;
|
|
141
|
+
cohortId: string;
|
|
142
|
+
sessionId: string;
|
|
143
|
+
aggregatedNonce: Uint8Array;
|
|
144
|
+
};
|
|
145
|
+
type SignatureAuthorizationMessage = {
|
|
146
|
+
from: string;
|
|
147
|
+
to: string;
|
|
148
|
+
cohortId: string;
|
|
149
|
+
sessionId: string;
|
|
150
|
+
partialSignature: Uint8Array;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Factory function for creating an Authorization Request message, which is sent by a participant to
|
|
154
|
+
* request authorization for their signature.
|
|
155
|
+
* @param {AuthorizationRequestMessage} fields - The fields required to create an Authorization
|
|
156
|
+
* Request message, which is sent by a participant to request authorization for their signature.
|
|
157
|
+
* @returns {BaseMessage} The created Authorization Request message.
|
|
158
|
+
*/
|
|
159
|
+
export declare function createAuthorizationRequestMessage(fields: AuthorizationRequestMessage): BaseMessage;
|
|
160
|
+
/**
|
|
161
|
+
* Factory function for creating a Nonce Contribution message, which is sent by a participant to
|
|
162
|
+
* contribute their nonce for the signature aggregation process.
|
|
163
|
+
* @param {NonceContributionMessage} fields - The fields required to create a Nonce Contribution
|
|
164
|
+
* message, which is sent by a participant to contribute their nonce for the signature aggregation
|
|
165
|
+
* process.
|
|
166
|
+
* @returns {BaseMessage} The created Nonce Contribution message.
|
|
167
|
+
*/
|
|
168
|
+
export declare function createNonceContributionMessage(fields: NonceContributionMessage): BaseMessage;
|
|
169
|
+
/**
|
|
170
|
+
* Factory function for creating an Aggregated Nonce message, which is sent by the aggregator to
|
|
171
|
+
* distribute the aggregated nonce to participants for the signature aggregation process.
|
|
172
|
+
* @param {AggregatedNonceMessage} fields - The fields required to create an Aggregated Nonce
|
|
173
|
+
* message, which is sent by the aggregator to distribute the aggregated nonce to participants for
|
|
174
|
+
* the signature aggregation process.
|
|
175
|
+
* @returns {BaseMessage} The created Aggregated Nonce message.
|
|
176
|
+
*/
|
|
177
|
+
export declare function createAggregatedNonceMessage(fields: AggregatedNonceMessage): BaseMessage;
|
|
178
|
+
/**
|
|
179
|
+
* Factory function for creating a Signature Authorization message, which is sent by a participant
|
|
180
|
+
* to authorize their partial signature for the signature aggregation process.
|
|
181
|
+
* @param {SignatureAuthorizationMessage} fields - The fields required to create a Signature
|
|
182
|
+
* Authorization message, which is sent by a participant to authorize their partial signature for
|
|
183
|
+
* the signature aggregation process.
|
|
184
|
+
* @returns {BaseMessage} The created Signature Authorization message.
|
|
185
|
+
*/
|
|
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;
|
|
216
|
+
export {};
|
|
217
|
+
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/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;IACtB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CA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AG,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided type is a valid aggregation message type.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isAggregationMessageType(type: string): boolean;
|
|
5
|
+
/** Checks if the message type belongs to the keygen phase. */
|
|
6
|
+
export declare function isKeygenMessageType(type: string): boolean;
|
|
7
|
+
/** Checks if the message type belongs to the update phase. */
|
|
8
|
+
export declare function isUpdateMessageType(type: string): boolean;
|
|
9
|
+
/** Checks if the message type belongs to the signing phase. */
|
|
10
|
+
export declare function isSignMessageType(type: string): boolean;
|
|
11
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/messages/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
2
|
+
import type { SerializedSMTProof } from '@did-btcr2/smt';
|
|
3
|
+
import type { CohortConditions } from './conditions.js';
|
|
4
|
+
import type { BaseMessage } from './messages/base.js';
|
|
5
|
+
import type { ParticipantCohortPhaseType } from './phases.js';
|
|
6
|
+
import type { AggregationSigner } from './signer.js';
|
|
7
|
+
/**
|
|
8
|
+
* Cohort advert as discovered by the participant (UI: list of joinable cohorts).
|
|
9
|
+
* Carries the advertised {@link CohortConditions} (beaconType, minParticipants,
|
|
10
|
+
* maxParticipants, costs, ...) so a `shouldJoin` decision can inspect them.
|
|
11
|
+
*/
|
|
12
|
+
export interface CohortAdvert extends CohortConditions {
|
|
13
|
+
cohortId: string;
|
|
14
|
+
serviceDid: string;
|
|
15
|
+
network: string;
|
|
16
|
+
serviceCommunicationPk: Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/** Joined cohort info, available after the cohort is finalized. */
|
|
19
|
+
export interface JoinedCohortInfo {
|
|
20
|
+
cohortId: string;
|
|
21
|
+
serviceDid: string;
|
|
22
|
+
beaconAddress: string;
|
|
23
|
+
cohortKeys: Array<Uint8Array>;
|
|
24
|
+
}
|
|
25
|
+
/** Aggregated data awaiting participant validation (UI: review for approval). */
|
|
26
|
+
export interface PendingValidation {
|
|
27
|
+
cohortId: string;
|
|
28
|
+
beaconType: string;
|
|
29
|
+
signalBytesHex: string;
|
|
30
|
+
casAnnouncement?: Record<string, string>;
|
|
31
|
+
smtProof?: SerializedSMTProof;
|
|
32
|
+
/** Canonical hash of this participant's update; empty for a decliner. */
|
|
33
|
+
expectedHash: string;
|
|
34
|
+
matches: boolean;
|
|
35
|
+
/** True if this participant submitted an update; false if it declined (non-inclusion). */
|
|
36
|
+
included: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Pending signing request (UI: review tx for approval). */
|
|
39
|
+
export interface PendingSigningRequest {
|
|
40
|
+
cohortId: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
pendingTxHex: string;
|
|
43
|
+
/** Hex-encoded scriptPubKey of the UTXO being spent. Required for BIP-341 sighash. */
|
|
44
|
+
prevOutScriptHex: string;
|
|
45
|
+
prevOutValue: string;
|
|
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
|
+
}
|
|
61
|
+
export interface AggregationParticipantParams {
|
|
62
|
+
did: string;
|
|
63
|
+
/**
|
|
64
|
+
* The participant's MuSig2 signing capability. The raw secret is materialized
|
|
65
|
+
* only for the duration of a single nonce/partial-sign operation (see ADR 038);
|
|
66
|
+
* pass a {@link KeyPairAggregationSigner} to back it with an in-memory keypair.
|
|
67
|
+
*/
|
|
68
|
+
signer: AggregationSigner;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sans-I/O state machine for an Aggregation Participant.
|
|
72
|
+
*
|
|
73
|
+
* Manages multiple cohorts simultaneously. The client app drives the state
|
|
74
|
+
* machine via `receive()` (for incoming messages) and explicit action methods
|
|
75
|
+
* (for user decisions). All outgoing messages are returned for the caller to
|
|
76
|
+
* send via whatever transport.
|
|
77
|
+
*
|
|
78
|
+
* @class AggregationParticipant
|
|
79
|
+
*/
|
|
80
|
+
export declare class AggregationParticipant {
|
|
81
|
+
#private;
|
|
82
|
+
readonly did: string;
|
|
83
|
+
constructor({ did, signer }: AggregationParticipantParams);
|
|
84
|
+
/** The participant's compressed (33-byte) MuSig2 public key. Not secret. */
|
|
85
|
+
get publicKey(): Uint8Array;
|
|
86
|
+
/**
|
|
87
|
+
* Process an incoming message. Updates internal state but never produces
|
|
88
|
+
* outgoing messages: those come exclusively from action methods.
|
|
89
|
+
*/
|
|
90
|
+
receive(message: BaseMessage): void;
|
|
91
|
+
/** Cohorts the participant has discovered but not yet joined. */
|
|
92
|
+
get discoveredCohorts(): ReadonlyMap<string, CohortAdvert>;
|
|
93
|
+
/**
|
|
94
|
+
* User action: join a discovered cohort.
|
|
95
|
+
* Returns the opt-in message to send.
|
|
96
|
+
*/
|
|
97
|
+
joinCohort(cohortId: string): BaseMessage[];
|
|
98
|
+
/** Cohorts that have been finalized: beacon address available. */
|
|
99
|
+
get joinedCohorts(): ReadonlyMap<string, JoinedCohortInfo>;
|
|
100
|
+
/**
|
|
101
|
+
* User action: submit a signed BTCR2 update for inclusion in the cohort's
|
|
102
|
+
* aggregated signal.
|
|
103
|
+
*/
|
|
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[];
|
|
112
|
+
/** Aggregated data awaiting user validation. */
|
|
113
|
+
get pendingValidations(): ReadonlyMap<string, PendingValidation>;
|
|
114
|
+
/**
|
|
115
|
+
* The validated aggregated data retained for a cohort, regardless of phase.
|
|
116
|
+
* Unlike {@link pendingValidations} (which lists only cohorts still awaiting
|
|
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
|
|
120
|
+
* undefined before aggregated data has been received.
|
|
121
|
+
*/
|
|
122
|
+
getValidation(cohortId: string): PendingValidation | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* User action: approve aggregated data and send validation ack.
|
|
125
|
+
*/
|
|
126
|
+
approveValidation(cohortId: string): BaseMessage[];
|
|
127
|
+
/**
|
|
128
|
+
* User action: reject aggregated data and send rejection ack.
|
|
129
|
+
*/
|
|
130
|
+
rejectValidation(cohortId: string): BaseMessage[];
|
|
131
|
+
/** Signing requests awaiting user approval. */
|
|
132
|
+
get pendingSigningRequests(): ReadonlyMap<string, PendingSigningRequest>;
|
|
133
|
+
/**
|
|
134
|
+
* User action: approve signing and generate nonce contribution.
|
|
135
|
+
*/
|
|
136
|
+
approveNonce(cohortId: string): BaseMessage[];
|
|
137
|
+
/**
|
|
138
|
+
* User action: generate and return the partial signature.
|
|
139
|
+
* In most UIs this is automatic after AwaitingPartialSig, but exposing it
|
|
140
|
+
* as an explicit action lets the client UI confirm before signing if desired.
|
|
141
|
+
*/
|
|
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[];
|
|
153
|
+
getCohortPhase(cohortId: string): ParticipantCohortPhaseType | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Zeroize any retained MuSig2 secret nonces across all cohorts. The raw
|
|
156
|
+
* signing key is never held here (it lives behind the {@link AggregationSigner}
|
|
157
|
+
* and is wiped per-operation), but an abandoned signing session can still hold
|
|
158
|
+
* a secret nonce; call this on teardown to clear it deterministically.
|
|
159
|
+
*/
|
|
160
|
+
clearSecrets(): void;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=participant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../src/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,K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