@did-btcr2/method 0.32.0 → 0.34.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.
Files changed (62) hide show
  1. package/README.md +25 -13
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/browser.js +332 -582
  4. package/dist/browser.mjs +332 -582
  5. package/dist/cjs/index.js +213 -35
  6. package/dist/esm/core/aggregation/beacon-strategy.js +5 -4
  7. package/dist/esm/core/aggregation/beacon-strategy.js.map +1 -1
  8. package/dist/esm/core/aggregation/runner/aggregation-runner.js +66 -0
  9. package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +1 -0
  10. package/dist/esm/core/aggregation/runner/index.js +1 -0
  11. package/dist/esm/core/aggregation/runner/index.js.map +1 -1
  12. package/dist/esm/core/aggregation/transport/in-memory.js +146 -0
  13. package/dist/esm/core/aggregation/transport/in-memory.js.map +1 -0
  14. package/dist/esm/core/aggregation/transport/index.js +1 -0
  15. package/dist/esm/core/aggregation/transport/index.js.map +1 -1
  16. package/dist/esm/core/beacon/beacon.js +10 -8
  17. package/dist/esm/core/beacon/beacon.js.map +1 -1
  18. package/dist/esm/core/beacon/cas-beacon.js +4 -4
  19. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  20. package/dist/esm/core/beacon/factory.js +1 -1
  21. package/dist/esm/core/beacon/singleton-beacon.js +4 -4
  22. package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
  23. package/dist/esm/core/beacon/smt-beacon.js +23 -15
  24. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  25. package/dist/esm/core/resolver.js +7 -4
  26. package/dist/esm/core/resolver.js.map +1 -1
  27. package/dist/types/core/aggregation/beacon-strategy.d.ts.map +1 -1
  28. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +56 -0
  29. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +1 -0
  30. package/dist/types/core/aggregation/runner/index.d.ts +1 -0
  31. package/dist/types/core/aggregation/runner/index.d.ts.map +1 -1
  32. package/dist/types/core/aggregation/transport/in-memory.d.ts +64 -0
  33. package/dist/types/core/aggregation/transport/in-memory.d.ts.map +1 -0
  34. package/dist/types/core/aggregation/transport/index.d.ts +1 -0
  35. package/dist/types/core/aggregation/transport/index.d.ts.map +1 -1
  36. package/dist/types/core/beacon/beacon.d.ts +12 -10
  37. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  38. package/dist/types/core/beacon/cas-beacon.d.ts +4 -4
  39. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
  40. package/dist/types/core/beacon/factory.d.ts +3 -3
  41. package/dist/types/core/beacon/factory.d.ts.map +1 -1
  42. package/dist/types/core/beacon/singleton-beacon.d.ts +4 -4
  43. package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
  44. package/dist/types/core/beacon/smt-beacon.d.ts +4 -4
  45. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
  46. package/dist/types/core/interfaces.d.ts +14 -11
  47. package/dist/types/core/interfaces.d.ts.map +1 -1
  48. package/dist/types/core/resolver.d.ts +1 -1
  49. package/dist/types/core/resolver.d.ts.map +1 -1
  50. package/package.json +20 -8
  51. package/src/core/aggregation/beacon-strategy.ts +5 -4
  52. package/src/core/aggregation/runner/aggregation-runner.ts +96 -0
  53. package/src/core/aggregation/runner/index.ts +1 -0
  54. package/src/core/aggregation/transport/in-memory.ts +174 -0
  55. package/src/core/aggregation/transport/index.ts +1 -0
  56. package/src/core/beacon/beacon.ts +12 -10
  57. package/src/core/beacon/cas-beacon.ts +4 -4
  58. package/src/core/beacon/factory.ts +3 -3
  59. package/src/core/beacon/singleton-beacon.ts +4 -4
  60. package/src/core/beacon/smt-beacon.ts +24 -16
  61. package/src/core/interfaces.ts +14 -11
  62. package/src/core/resolver.ts +9 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { SchnorrKeyPair } from '@did-btcr2/keypair';
2
+ import type { BaseMessage } from '../messages/base.js';
3
+ import type { MessageHandler, Transport } from './transport.js';
4
+ /**
5
+ * In-process message bus connecting one or more {@link InMemoryTransport}
6
+ * instances. Routes broadcasts to every registered actor and directed messages
7
+ * to the actor that owns the recipient DID — with no relay, server, or network.
8
+ *
9
+ * Each delivery does a JSON round-trip (Uint8Array preserved as `__bytes` hex)
10
+ * so handlers receive an isolated, serialization-faithful copy, exactly as a
11
+ * real transport would. The message `body` is merged to the top level to match
12
+ * the shape the {@link NostrTransport} dispatch produces.
13
+ *
14
+ * @class InMemoryBus
15
+ */
16
+ export declare class InMemoryBus {
17
+ #private;
18
+ /** Attach a transport to this bus. Called by the transport's constructor. */
19
+ register(transport: InMemoryTransport): void;
20
+ /** Detach a transport from this bus. */
21
+ unregister(transport: InMemoryTransport): void;
22
+ /**
23
+ * Deliver a message. With no `recipient` the message is broadcast to every
24
+ * actor on the bus; otherwise it is routed to the single transport that owns
25
+ * the recipient DID.
26
+ */
27
+ deliver(message: BaseMessage, _sender: string, recipient?: string): Promise<void>;
28
+ }
29
+ /**
30
+ * In-process {@link Transport} that routes aggregation messages through an
31
+ * {@link InMemoryBus} instead of a relay or HTTP server. Supports multiple
32
+ * actors per instance, so a single transport can host both a service and its
33
+ * participants (e.g. a cohort-of-one via {@link AggregationRunner.solo}).
34
+ *
35
+ * Encryption is a no-op (in-process, same trust domain); `registerPeer` /
36
+ * `getPeerPk` keep a registry so the contract matches the wire transports.
37
+ *
38
+ * @class InMemoryTransport
39
+ * @implements {Transport}
40
+ */
41
+ export declare class InMemoryTransport implements Transport {
42
+ #private;
43
+ name: string;
44
+ readonly bus: InMemoryBus;
45
+ /** @param bus Shared bus. Pass the same bus to connect multiple transports. */
46
+ constructor(bus?: InMemoryBus);
47
+ start(): void;
48
+ registerActor(did: string, keys: SchnorrKeyPair): void;
49
+ getActorPk(did: string): Uint8Array | undefined;
50
+ /** True if `did` is registered on this transport. Used by the bus for routing. */
51
+ hasActor(did: string): boolean;
52
+ registerPeer(did: string, communicationPk: Uint8Array): void;
53
+ getPeerPk(did: string): Uint8Array | undefined;
54
+ registerMessageHandler(actorDid: string, messageType: string, handler: MessageHandler): void;
55
+ unregisterMessageHandler(actorDid: string, messageType: string): void;
56
+ unregisterActor(did: string): void;
57
+ sendMessage(message: BaseMessage, sender: string, recipient?: string): Promise<void>;
58
+ publishRepeating(message: BaseMessage, sender: string, intervalMs: number, recipient?: string): () => void;
59
+ /** Deliver a broadcast message to every actor on this transport that handles `type`. */
60
+ dispatchBroadcast(type: string, message: unknown): Promise<void>;
61
+ /** Deliver a directed message to the recipient actor's handler for `type`. */
62
+ dispatchDirected(recipientDid: string, type: string, message: unknown): Promise<void>;
63
+ }
64
+ //# sourceMappingURL=in-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhE;;;;;;;;;;;GAWG;AACH,qBAAa,WAAW;;IAGtB,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,iBAAiB,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AAI;IAcb,wFAAwF;IAClF,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtE,8EAA8E;IACxE,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5F"}
@@ -1,6 +1,7 @@
1
1
  export * from './transport.js';
2
2
  export * from './error.js';
3
3
  export * from './factory.js';
4
+ export * from './in-memory.js';
4
5
  export * from './nostr.js';
5
6
  export * from './didcomm.js';
6
7
  export * from './http/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
@@ -48,7 +48,7 @@ export declare function detectSingletonScriptKind(bitcoinAddress: string, networ
48
48
  */
49
49
  export declare function deriveSingletonAddress(kind: SingletonScriptKind, pubkey: KeyBytes, network: BTCNetwork): string;
50
50
  /**
51
- * Options accepted by {@link Beacon.buildSignAndBroadcast} and related helpers.
51
+ * Options accepted by {@link SinglePartyBeacon.buildSignAndBroadcast} and related helpers.
52
52
  */
53
53
  export interface BroadcastOptions {
54
54
  /** Fee estimator for computing the transaction fee. Defaults to {@link DEFAULT_FEE_ESTIMATOR}. */
@@ -73,13 +73,13 @@ export interface BeaconTxPlan {
73
73
  feeSats: bigint;
74
74
  /**
75
75
  * Singleton beacon script kind, when applicable. Drives the signing dispatch
76
- * in {@link Beacon.signSinglePartyTx}. Aggregation plans set this to `'p2tr'`.
76
+ * in {@link SinglePartyBeacon.signSinglePartyTx}. Aggregation plans set this to `'p2tr'`.
77
77
  */
78
78
  scriptKind: SingletonScriptKind;
79
79
  }
80
80
  /**
81
81
  * Build an OP_RETURN script carrying a 32-byte beacon signal.
82
- * Exported as a utility so callers building txs outside Beacon (e.g., the aggregation
82
+ * Exported as a utility so callers building txs outside SinglePartyBeacon (e.g., the aggregation
83
83
  * `onProvideTxData` callback) can produce identical output.
84
84
  *
85
85
  * Uses the opcode *string* `'RETURN'` rather than the numeric `OP.RETURN`
@@ -96,7 +96,7 @@ export declare function opReturnScript(signalBytes: Uint8Array): Uint8Array;
96
96
  * Returns the unsigned Transaction + prev-output metadata that an aggregation service's
97
97
  * signing session consumes (via {@link SigningTxData}).
98
98
  *
99
- * This is the reusable counterpart to {@link Beacon.buildSignAndBroadcast}'s internal
99
+ * This is the reusable counterpart to {@link SinglePartyBeacon.buildSignAndBroadcast}'s internal
100
100
  * construction step — the aggregation path must produce an unsigned tx because the
101
101
  * signature comes from a MuSig2 round, not a local secret key.
102
102
  *
@@ -118,9 +118,11 @@ export declare function buildAggregationBeaconTx(opts: {
118
118
  feeEstimator?: FeeEstimator;
119
119
  }): Promise<BeaconTxPlan>;
120
120
  /**
121
- * Abstract base class for all BTCR2 Beacon types.
122
- * A Beacon is a service listed in a BTCR2 DID document that informs resolvers
123
- * how to find authentic updates to the DID.
121
+ * Abstract base class providing the single-party broadcast machinery shared by
122
+ * all BTCR2 beacon types: one party holds one key and broadcasts one 32-byte
123
+ * signal (P2PKH / P2WPKH / P2TR key-path). The aggregation (cohort of N >= 1)
124
+ * broadcast mode is the orthogonal axis, handled by the AggregationService and
125
+ * {@link buildAggregationBeaconTx}, not by this class hierarchy. See ADR 037.
124
126
  *
125
127
  * Beacons are lightweight typed wrappers around a {@link BeaconService} configuration.
126
128
  * Dependencies (signals, sidecar data, bitcoin connection) are passed as method
@@ -129,10 +131,10 @@ export declare function buildAggregationBeaconTx(opts: {
129
131
  * Use {@link BeaconFactory.establish} to create typed instances from service config.
130
132
  *
131
133
  * @abstract
132
- * @class Beacon
133
- * @type {Beacon}
134
+ * @class SinglePartyBeacon
135
+ * @type {SinglePartyBeacon}
134
136
  */
135
- export declare abstract class Beacon {
137
+ export declare abstract class SinglePartyBeacon {
136
138
  /**
137
139
  * The Beacon service configuration parsed from the DID Document.
138
140
  */
@@ -1 +1 @@
1
- {"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAA4D,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKnE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,sBAAs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5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAEtB;;;;;;;;;OASG;IACH,QAAQ,CAAC,eAAe,CACtB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAE7B;;;;;;;;;;;;;;;;;OAiBG;cACa,qBAAqB,CACnC,WAAW,EAAE,UAAU,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,MAAM,CAAC;IAWlB;;;;;;;;;OASG;cACa,kBAAkB,CAAC,IAAI,EAAE;QACvC,WAAW,EAAE,UAAU,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,WAAW,CAAC;QAClB,WAAW,EAAE,UAAU,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,iBAAiB,CAAC;QAC3B,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,YAAY,CAAC;IA0EzB;;;OAGG;cACa,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOtF;;OAEG;cACa,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F"}
@@ -4,7 +4,7 @@ import type { Signer } from '@did-btcr2/keypair';
4
4
  import type { BeaconProcessResult } from '../resolver.js';
5
5
  import type { SidecarData } from '../types.js';
6
6
  import type { BroadcastOptions } from './beacon.js';
7
- import { Beacon } from './beacon.js';
7
+ import { SinglePartyBeacon } from './beacon.js';
8
8
  import type { BeaconService, BeaconSignal, CasPublishFn } from './interfaces.js';
9
9
  /**
10
10
  * CAS-specific broadcast options — extends {@link BroadcastOptions} with an optional
@@ -25,9 +25,9 @@ export interface CASBroadcastOptions extends BroadcastOptions {
25
25
  *
26
26
  * @class CASBeacon
27
27
  * @type {CASBeacon}
28
- * @extends {Beacon}
28
+ * @extends {SinglePartyBeacon}
29
29
  */
30
- export declare class CASBeacon extends Beacon {
30
+ export declare class CASBeacon extends SinglePartyBeacon {
31
31
  /**
32
32
  * Creates an instance of CASBeacon.
33
33
  * @param {BeaconService} service The service of the Beacon.
@@ -53,7 +53,7 @@ export declare class CASBeacon extends Beacon {
53
53
  * Creates a CAS Announcement mapping the DID to the update hash, broadcasts the hash of the
54
54
  * announcement via OP_RETURN, and optionally publishes the announcement off-chain via the
55
55
  * supplied `casPublish` callback. UTXO selection, PSBT construction, fee estimation, signing,
56
- * and broadcast are delegated to {@link Beacon.buildSignAndBroadcast}.
56
+ * and broadcast are delegated to {@link SinglePartyBeacon.buildSignAndBroadcast}.
57
57
  *
58
58
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
59
59
  * @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
@@ -1 +1 @@
1
- {"version":3,"file":"cas-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,YAAY,EAAE,MAAM,iBAAiB,CA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,iBAAiB;IAC9C;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAsDtB;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,iBAAiB,CAAC;CAuB9B"}
@@ -1,4 +1,4 @@
1
- import type { Beacon } from './beacon.js';
1
+ import type { SinglePartyBeacon } from './beacon.js';
2
2
  import type { BeaconService } from './interfaces.js';
3
3
  /**
4
4
  * Beacon Factory pattern to create Beacon instances.
@@ -9,8 +9,8 @@ export declare class BeaconFactory {
9
9
  /**
10
10
  * Establish a Beacon instance based on the provided service and optional sidecar data.
11
11
  * @param {BeaconService} service The beacon service configuration.
12
- * @returns {Beacon} The established Beacon instance.
12
+ * @returns {SinglePartyBeacon} The established Beacon instance.
13
13
  */
14
- static establish(service: BeaconService): Beacon;
14
+ static establish(service: BeaconService): SinglePartyBeacon;
15
15
  }
16
16
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;CAYjD"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,iBAAiB;CAY5D"}
@@ -4,15 +4,15 @@ import type { Signer } from '@did-btcr2/keypair';
4
4
  import type { BeaconProcessResult } from '../resolver.js';
5
5
  import type { SidecarData } from '../types.js';
6
6
  import type { BroadcastOptions } from './beacon.js';
7
- import { Beacon } from './beacon.js';
7
+ import { SinglePartyBeacon } from './beacon.js';
8
8
  import type { BeaconService, BeaconSignal } from './interfaces.js';
9
9
  /**
10
10
  * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#singleton-beacon | Singleton Beacon}.
11
11
  * @class SingletonBeacon
12
12
  * @type {SingletonBeacon}
13
- * @extends {Beacon}
13
+ * @extends {SinglePartyBeacon}
14
14
  */
15
- export declare class SingletonBeacon extends Beacon {
15
+ export declare class SingletonBeacon extends SinglePartyBeacon {
16
16
  /**
17
17
  * Creates an instance of SingletonBeacon.
18
18
  * @param {BeaconService} service The BeaconService object representing the funded beacon to announce the update to.
@@ -30,7 +30,7 @@ export declare class SingletonBeacon extends Beacon {
30
30
  *
31
31
  * The signal bytes embedded in OP_RETURN are the SHA-256 canonical hash of the signed update.
32
32
  * UTXO selection, PSBT construction, fee estimation, signing, and broadcast are delegated to
33
- * {@link Beacon.buildSignAndBroadcast}.
33
+ * {@link SinglePartyBeacon.buildSignAndBroadcast}.
34
34
  *
35
35
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
36
36
  * @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
@@ -1 +1 @@
1
- {"version":3,"file":"singleton-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBA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,aAAa,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,iBAAiB;IAEpD;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;OAKG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IA0BtB;;;;;;;;;;;;;OAaG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAK9B"}
@@ -4,7 +4,7 @@ import type { Signer } from '@did-btcr2/keypair';
4
4
  import type { BeaconProcessResult } from '../resolver.js';
5
5
  import type { SidecarData } from '../types.js';
6
6
  import type { BroadcastOptions } from './beacon.js';
7
- import { Beacon } from './beacon.js';
7
+ import { SinglePartyBeacon } from './beacon.js';
8
8
  import type { BeaconService, BeaconSignal } from './interfaces.js';
9
9
  /**
10
10
  * Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-beacon | SMT Beacon}.
@@ -16,9 +16,9 @@ import type { BeaconService, BeaconSignal } from './interfaces.js';
16
16
  *
17
17
  * @class SMTBeacon
18
18
  * @type {SMTBeacon}
19
- * @extends {Beacon}
19
+ * @extends {SinglePartyBeacon}
20
20
  */
21
- export declare class SMTBeacon extends Beacon {
21
+ export declare class SMTBeacon extends SinglePartyBeacon {
22
22
  /**
23
23
  * Creates an instance of SMTBeacon.
24
24
  * @param {BeaconService} service The Beacon service.
@@ -44,7 +44,7 @@ export declare class SMTBeacon extends Beacon {
44
44
  * Builds a single-entry Sparse Merkle Tree from the signed update, then broadcasts the tree's
45
45
  * root hash via OP_RETURN. For multi-party aggregation, use the {@link AggregationService}
46
46
  * subsystem directly instead of this method. UTXO selection, PSBT construction, fee estimation,
47
- * signing, and broadcast are delegated to {@link Beacon.buildSignAndBroadcast}.
47
+ * signing, and broadcast are delegated to {@link SinglePartyBeacon.buildSignAndBroadcast}.
48
48
  *
49
49
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
50
50
  * @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
@@ -1 +1 @@
1
- {"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAiEtB;;;;;;;;;;;;;;OAcG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAgB9B"}
1
+ {"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAyEtB;;;;;;;;;;;;;;OAcG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAgB9B"}
@@ -38,36 +38,39 @@ export interface ResolutionOptions extends DidResolutionOptions {
38
38
  * a path from a leaf in the tree to the Merkle root, proving that the leaf is in the tree.
39
39
  * See {@link https://dcdpr.github.io/did-btcr2/data-structures.html#smt-proof | SMT Proof (data structure)}.
40
40
  *
41
+ * All SHA-256 hash fields (`id`, `nonce`, `updateId`, `hashes`) are "base64url"
42
+ * [RFC4648] encoded without padding (43 chars each). `collapsed` is the 256-bit
43
+ * zero-node bitmap, also base64url no-pad (43 chars).
44
+ *
41
45
  * @example
42
46
  * ```json
43
47
  * {
44
- * "id": "<< Hexadecimal of Root Hash >>",
45
- * "nonce": "<< Hexadecimal of Nonce 1101 >>",
46
- * "updateId": "<< Hexadecimal of hash(Data Block 1101) >>",
47
- * "collapsed": "<< Hexadecimal of 0001 >>",
48
+ * "id": "q1H_iaYG0Oq6gbrycYL-r7FjUsJLnIpHDn49TLeONNA",
49
+ * "nonce": "99jndCBWHpZfmObXlIvRGHaPMgoQKXIETdD4H-XqryE",
50
+ * "updateId": "njYNViJq2OmhSw1fLfARPCj12RY3VXKGWdS3-7OQ2BE",
51
+ * "collapsed": "v_________________________________________8",
48
52
  * "hashes": [
49
- * "<< Hexadecimal of Hash 1110 >>",
50
- * "<< Hexadecimal of Hash 1001 >>",
51
- * "<< Hexadecimal of Hash 0 >>"
53
+ * "8JWXL7chPKJXwg-i9O1EFTHan_oOO_RmglDpu_ugax0"
52
54
  * ]
53
55
  * }
54
56
  * ```
55
57
  */
56
58
  export interface SMTProof {
57
59
  /**
58
- * The SHA-256 hash of the root node of the Sparse Merkle Tree.
60
+ * base64url (no padding) SHA-256 hash of the root node of the Sparse Merkle Tree.
59
61
  */
60
62
  id: string;
61
63
  /**
62
- * Optional 256-bit nonce generated for each update. Hex-encoded (64 chars).
64
+ * Optional 256-bit nonce generated for each update. base64url, no padding (43 chars).
63
65
  */
64
66
  nonce?: string;
65
67
  /**
66
- * Optional hex-encoded canonical hash of the BTCR2 Signed Update.
68
+ * Optional base64url (no padding) canonical hash of the BTCR2 Signed Update.
67
69
  */
68
70
  updateId?: string;
69
71
  /**
70
- * Bitmap of zero nodes within the path (see: collapsed leaves).
72
+ * base64url (no padding) bitmap of zero nodes within the path (see: collapsed
73
+ * leaves). Bit set = empty/zero sibling; bit clear = a sibling hash is present.
71
74
  */
72
75
  collapsed: string;
73
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -66,7 +66,7 @@ export type ResolverState = {
66
66
  result: DidResolutionResponse;
67
67
  };
68
68
  /**
69
- * Return type from {@link Beacon.processSignals}.
69
+ * Return type from {@link SinglePartyBeacon.processSignals}.
70
70
  * Contains successfully resolved updates and any data needs that must be
71
71
  * satisfied before the remaining signals can be processed.
72
72
  */
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,KAAK,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGxE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAA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AG,IAAI;IACtD,OAAO,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI;IACrF,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI;IAC/D,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAC9D,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;CA4ClD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-btcr2/method",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "type": "module",
5
5
  "description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
6
6
  "main": "./dist/cjs/index.js",
@@ -80,11 +80,11 @@
80
80
  "helia": "^5.5.1",
81
81
  "multiformats": "^13.4.2",
82
82
  "nostr-tools": "^2.23.3",
83
- "@did-btcr2/bitcoin": "^0.6.0",
83
+ "@did-btcr2/smt": "^0.3.0",
84
84
  "@did-btcr2/common": "^9.1.0",
85
- "@did-btcr2/cryptosuite": "^8.0.0",
86
- "@did-btcr2/smt": "^0.2.4",
87
- "@did-btcr2/keypair": "^0.13.0"
85
+ "@did-btcr2/bitcoin": "^0.6.0",
86
+ "@did-btcr2/keypair": "^0.13.0",
87
+ "@did-btcr2/cryptosuite": "^8.0.0"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@eslint/js": "^9.39.4",
@@ -98,6 +98,7 @@
98
98
  "c8": "^10.1.3",
99
99
  "chai": "^5.3.3",
100
100
  "chai-as-promised": "^8.0.2",
101
+ "commander": "^13.1.0",
101
102
  "esbuild": "^0.24.2",
102
103
  "eslint": "^9.39.4",
103
104
  "eslint-plugin-mocha": "^10.5.0",
@@ -132,12 +133,23 @@
132
133
  "lint": "eslint . --max-warnings 0",
133
134
  "lint:fix": "eslint . --fix",
134
135
  "test": "pnpm c8 mocha",
135
- "test:unit": "[ -z \"$FILE_NAME\" ] && echo 'ERROR: FILE_NAME is not set' || pnpm tsx lib/test-$FILE_NAME.ts",
136
+ "test:unit": "[ -z \"$FILE_NAME\" ] && echo 'ERROR: FILE_NAME is not set' || bun lib/test-$FILE_NAME.ts",
136
137
  "build:test": "pnpm build && pnpm build:tests && pnpm c8 mocha",
137
138
  "build:lint:test": "pnpm build && pnpm build:tests && pnpm lint:fix",
138
139
  "prepublish": "pnpm build",
139
- "generate:vector": "pnpm tsx lib/generate-vector.ts",
140
- "do": "pnpm tsx",
140
+ "generate:vector": "bun lib/generate-vector.ts",
141
+ "generate:scenario": "bun lib/generate-scenario.ts",
142
+ "scenario:keys": "bun lib/scenario-keys.ts",
143
+ "scenario:artifacts": "bun lib/build-artifacts.ts",
144
+ "scenario:route": "bun lib/route-delivery.ts",
145
+ "scenario:publish": "bun lib/publish-scenarios.ts",
146
+ "scenario:funding": "bun lib/aggregate-funding.ts",
147
+ "scenario:fund": "bun lib/fund-scenarios.ts",
148
+ "scenario:anchor": "bun lib/anchor-scenarios.ts",
149
+ "scenario:verify": "bun lib/verify-scenarios.ts",
150
+ "scenario:verify:live": "bun lib/verify-live.ts",
151
+ "wallet": "bun lib/wallet/cli.ts",
152
+ "do": "bun",
141
153
  "do:lib": "${PWD}/lib/run-lib.sh",
142
154
  "pack:local": "pnpm pack && mv *.tgz ./release"
143
155
  }
@@ -1,7 +1,7 @@
1
1
  import { canonicalize } from '@did-btcr2/common';
2
2
  import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
3
3
  import type { SerializedSMTProof } from '@did-btcr2/smt';
4
- import { blockHash, didToIndex, hashToHex, hexToHash, verifySerializedProof } from '@did-btcr2/smt';
4
+ import { base64UrlToHash, blockHash, didToIndex, hashToBase64Url, verifySerializedProof } from '@did-btcr2/smt';
5
5
  import type { AggregationCohort } from './cohort.js';
6
6
  import type { BaseBody } from './messages/base.js';
7
7
 
@@ -90,15 +90,16 @@ const SMT_STRATEGY: AggregateBeaconStrategy = {
90
90
  validateParticipantView({ participantDid, submittedUpdate, body }) {
91
91
  const smtProof = body.smtProof as unknown as SerializedSMTProof | undefined;
92
92
  if(!smtProof?.updateId || !smtProof?.nonce) return { matches: false };
93
- // Verify updateId matches the canonicalized update hash
93
+ // Verify updateId matches the canonicalized update hash. Proof hash fields
94
+ // are base64url (no padding) per the SMT Proof spec.
94
95
  const canonicalBytes = new TextEncoder().encode(canonicalize(submittedUpdate as unknown as Record<string, unknown>));
95
- const expectedUpdateId = hashToHex(blockHash(canonicalBytes));
96
+ const expectedUpdateId = hashToBase64Url(blockHash(canonicalBytes));
96
97
  if(smtProof.updateId !== expectedUpdateId) {
97
98
  return { matches: false, smtProof };
98
99
  }
99
100
  // Verify Merkle inclusion
100
101
  const index = didToIndex(participantDid);
101
- const candidateHash = blockHash(blockHash(hexToHash(smtProof.nonce)), hexToHash(smtProof.updateId));
102
+ const candidateHash = blockHash(blockHash(base64UrlToHash(smtProof.nonce)), base64UrlToHash(smtProof.updateId));
102
103
  return {
103
104
  matches : verifySerializedProof(smtProof, index, candidateHash),
104
105
  smtProof,
@@ -0,0 +1,96 @@
1
+ import type { SchnorrKeyPair } from '@did-btcr2/keypair';
2
+ import type { AggregationResult } from '../service.js';
3
+ import { InMemoryBus, InMemoryTransport } from '../transport/in-memory.js';
4
+ import { AggregationParticipantRunner } from './participant-runner.js';
5
+ import type { OnProvideUpdate } from './participant-runner.js';
6
+ import { AggregationServiceRunner } from './service-runner.js';
7
+ import type { OnProvideTxData } from './service-runner.js';
8
+
9
+ /** Identity (DID + keys) for one actor in an {@link AggregationRunner.solo} run. */
10
+ export interface SoloActor {
11
+ did: string;
12
+ keys: SchnorrKeyPair;
13
+ }
14
+
15
+ /** Options for {@link AggregationRunner.solo}. */
16
+ export interface SoloCohortOptions {
17
+ /** The coordinating service identity. */
18
+ service: SoloActor;
19
+ /** The single participant identity (the lone signer of the cohort). */
20
+ participant: SoloActor;
21
+ /** Bitcoin network and beacon type (`'CASBeacon'` | `'SMTBeacon'`) for the cohort. */
22
+ config: { network: string; beaconType: string };
23
+ /** Provide the participant's signed BTCR2 update for the cohort. */
24
+ onProvideUpdate: OnProvideUpdate;
25
+ /** Provide the Bitcoin transaction data the cohort signs. */
26
+ onProvideTxData: OnProvideTxData;
27
+ /** Optional overall wall-clock budget for the run (ms). */
28
+ cohortTtlMs?: number;
29
+ /** Optional per-phase stall timeout (ms). */
30
+ phaseTimeoutMs?: number;
31
+ }
32
+
33
+ /**
34
+ * High-level facades for driving an aggregation cohort to completion.
35
+ *
36
+ * @class AggregationRunner
37
+ */
38
+ export class AggregationRunner {
39
+ /**
40
+ * Run a cohort of ONE participant entirely in-process and return the
41
+ * aggregated MuSig2 result.
42
+ *
43
+ * One party plays both the coordinating service and the lone participant,
44
+ * connected over an {@link InMemoryTransport} (no relay or HTTP server). This
45
+ * makes the single-participant aggregate-beacon path — the N=1 corner of the
46
+ * two-axis beacon matrix (see ADR 037) — first-class, useful for generating
47
+ * and reproducing single-participant aggregate test vectors.
48
+ *
49
+ * The service advertises a cohort with `minParticipants: 1`; the participant
50
+ * joins, submits its update, and the two complete keygen, data distribution,
51
+ * validation, and a one-signer MuSig2 P2TR key-path signing round.
52
+ *
53
+ * @param options Service + participant identities, cohort config, and the
54
+ * update / tx-data callbacks.
55
+ * @returns The {@link AggregationResult} (cohort id, aggregated signature, signed tx).
56
+ */
57
+ static async solo(options: SoloCohortOptions): Promise<AggregationResult> {
58
+ const transport = new InMemoryTransport(new InMemoryBus());
59
+ transport.registerActor(options.service.did, options.service.keys);
60
+ transport.registerActor(options.participant.did, options.participant.keys);
61
+ // Pre-register communication keys both ways. Production exchanges these via
62
+ // the protocol handshake; in-process we wire them directly.
63
+ transport.registerPeer(options.participant.did, options.participant.keys.publicKey.compressed);
64
+ transport.registerPeer(options.service.did, options.service.keys.publicKey.compressed);
65
+ transport.start();
66
+
67
+ const service = new AggregationServiceRunner({
68
+ transport,
69
+ did : options.service.did,
70
+ keys : options.service.keys,
71
+ config : { minParticipants: 1, network: options.config.network, beaconType: options.config.beaconType },
72
+ onProvideTxData : options.onProvideTxData,
73
+ cohortTtlMs : options.cohortTtlMs,
74
+ phaseTimeoutMs : options.phaseTimeoutMs,
75
+ // In-process bus with the participant already listening: a single advert
76
+ // suffices, so disable the republish loop (no dangling interval).
77
+ advertRepeatIntervalMs : 0,
78
+ });
79
+
80
+ const participant = new AggregationParticipantRunner({
81
+ transport,
82
+ did : options.participant.did,
83
+ keys : options.participant.keys,
84
+ shouldJoin : async () => true,
85
+ onProvideUpdate : options.onProvideUpdate,
86
+ });
87
+
88
+ await participant.start();
89
+ try {
90
+ return await service.run();
91
+ } finally {
92
+ participant.stop();
93
+ service.stop();
94
+ }
95
+ }
96
+ }
@@ -2,3 +2,4 @@ export * from './typed-emitter.js';
2
2
  export * from './events.js';
3
3
  export * from './service-runner.js';
4
4
  export * from './participant-runner.js';
5
+ export * from './aggregation-runner.js';