@did-btcr2/method 0.27.0 → 0.28.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.
@@ -0,0 +1,269 @@
1
+ var _a;
2
+ import { canonicalHash, INVALID_DID_UPDATE, JSONPatch, UpdateError } from '@did-btcr2/common';
3
+ import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
4
+ import { DidDocument } from '../utils/did-document.js';
5
+ import { BeaconFactory } from './beacon/factory.js';
6
+ /**
7
+ * Internal phases of the Updater state machine.
8
+ * @internal
9
+ */
10
+ var UpdaterPhase;
11
+ (function (UpdaterPhase) {
12
+ UpdaterPhase["Construct"] = "Construct";
13
+ UpdaterPhase["Sign"] = "Sign";
14
+ UpdaterPhase["Fund"] = "Fund";
15
+ UpdaterPhase["Broadcast"] = "Broadcast";
16
+ UpdaterPhase["Complete"] = "Complete";
17
+ })(UpdaterPhase || (UpdaterPhase = {}));
18
+ /**
19
+ * Sans-I/O state machine for did:btcr2 updates — the counterpart to {@link Resolver}.
20
+ *
21
+ * Created by {@link DidBtcr2.update} (the factory). The caller drives the update by
22
+ * repeatedly calling {@link advance} and {@link provide}:
23
+ *
24
+ * ```typescript
25
+ * const updater = DidBtcr2.update({ sourceDocument, patches, ... });
26
+ * let state = updater.advance();
27
+ *
28
+ * while(state.status === 'action-required') {
29
+ * for(const need of state.needs) {
30
+ * switch(need.kind) {
31
+ * case 'NeedSigningKey':
32
+ * updater.provide(need, secretKeyBytes);
33
+ * break;
34
+ * case 'NeedFunding':
35
+ * // Check UTXOs at need.beaconAddress, fund if needed
36
+ * updater.provide(need);
37
+ * break;
38
+ * case 'NeedBroadcast':
39
+ * await Updater.announce(need.beaconService, need.signedUpdate, secretKey, bitcoin);
40
+ * updater.provide(need);
41
+ * break;
42
+ * }
43
+ * }
44
+ * state = updater.advance();
45
+ * }
46
+ *
47
+ * const { signedUpdate } = state.result;
48
+ * ```
49
+ *
50
+ * The Updater performs **zero I/O**. All external work (signing with a KMS or raw
51
+ * key, funding checks, Bitcoin transaction construction, broadcast) flows through
52
+ * the advance/provide protocol. This mirrors the {@link Resolver} pattern and makes
53
+ * the update path transport-agnostic and KMS-ready.
54
+ *
55
+ * The class also exposes static utility methods ({@link construct}, {@link sign},
56
+ * {@link announce}) for callers that need direct access to individual update steps
57
+ * outside the state machine (e.g., test vector generation scripts).
58
+ *
59
+ * @class Updater
60
+ */
61
+ export class Updater {
62
+ #phase = UpdaterPhase.Construct;
63
+ #sourceDocument;
64
+ #patches;
65
+ #sourceVersionId;
66
+ #verificationMethod;
67
+ #beaconService;
68
+ #unsignedUpdate = null;
69
+ #signedUpdate = null;
70
+ /**
71
+ * @internal — Use {@link DidBtcr2.update} to create instances.
72
+ */
73
+ constructor(params) {
74
+ this.#sourceDocument = params.sourceDocument;
75
+ this.#patches = params.patches;
76
+ this.#sourceVersionId = params.sourceVersionId;
77
+ this.#verificationMethod = params.verificationMethod;
78
+ this.#beaconService = params.beaconService;
79
+ }
80
+ // ─── Public static utility methods ─────────────────────────────────────────
81
+ // Used by generate-vector.ts and other scripts that need direct access to
82
+ // individual update steps outside the state machine flow.
83
+ /**
84
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-unsigned-update | 7.3.b Construct BTCR2 Unsigned Update}.
85
+ *
86
+ * @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
87
+ * @param {PatchOperation[]} patches The JSON Patch operations to apply.
88
+ * @param {number} sourceVersionId The version ID of the source document.
89
+ * @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
90
+ * @throws {UpdateError} If the target document fails DID Core validation.
91
+ */
92
+ static construct(sourceDocument, patches, sourceVersionId) {
93
+ const unsignedUpdate = {
94
+ '@context': [
95
+ 'https://w3id.org/security/v2',
96
+ 'https://w3id.org/zcap/v1',
97
+ 'https://w3id.org/json-ld-patch/v1',
98
+ 'https://btcr2.dev/context/v1'
99
+ ],
100
+ patch: patches,
101
+ targetHash: '',
102
+ targetVersionId: sourceVersionId + 1,
103
+ sourceHash: canonicalHash(sourceDocument),
104
+ };
105
+ const targetDocument = JSONPatch.apply(sourceDocument, patches);
106
+ try {
107
+ DidDocument.isValid(targetDocument);
108
+ }
109
+ catch (error) {
110
+ throw new UpdateError('Error validating targetDocument: ' + (error instanceof Error ? error.message : String(error)), INVALID_DID_UPDATE, targetDocument);
111
+ }
112
+ unsignedUpdate.targetHash = canonicalHash(targetDocument);
113
+ return unsignedUpdate;
114
+ }
115
+ /**
116
+ * Implements subsection {@link http://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-signed-update | 7.3.c Construct BTCR2 Signed Update }.
117
+ *
118
+ * @param {string} did The did-btcr2 identifier to derive the root capability from.
119
+ * @param {UnsignedBTCR2Update} unsignedUpdate The unsigned update to sign.
120
+ * @param {DidVerificationMethod} verificationMethod The verification method for signing.
121
+ * @param {KeyBytes} secretKey The secret key bytes.
122
+ * @returns {SignedBTCR2Update} The signed update with a Data Integrity proof.
123
+ */
124
+ static sign(did, unsignedUpdate, verificationMethod, secretKey) {
125
+ const controller = verificationMethod.controller;
126
+ const id = verificationMethod.id.slice(verificationMethod.id.indexOf('#'));
127
+ const multikey = SchnorrMultikey.fromSecretKey(id, controller, secretKey);
128
+ const config = {
129
+ '@context': [
130
+ 'https://w3id.org/security/v2',
131
+ 'https://w3id.org/zcap/v1',
132
+ 'https://w3id.org/json-ld-patch/v1',
133
+ 'https://btcr2.dev/context/v1'
134
+ ],
135
+ cryptosuite: 'bip340-jcs-2025',
136
+ type: 'DataIntegrityProof',
137
+ verificationMethod: verificationMethod.id,
138
+ proofPurpose: 'capabilityInvocation',
139
+ capability: `urn:zcap:root:${encodeURIComponent(did)}`,
140
+ capabilityAction: 'Write',
141
+ };
142
+ const diproof = multikey.toCryptosuite().toDataIntegrityProof();
143
+ return diproof.addProof(unsignedUpdate, config);
144
+ }
145
+ /**
146
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#announce-did-update | 7.3.d Announce DID Update}.
147
+ * Announces a signed update to the Bitcoin blockchain via the specified beacon.
148
+ *
149
+ * @param {BeaconService} beaconService The beacon service to broadcast through.
150
+ * @param {SignedBTCR2Update} update The signed update to announce.
151
+ * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
152
+ * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
153
+ * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
154
+ */
155
+ static async announce(beaconService, update, secretKey, bitcoin) {
156
+ const beacon = BeaconFactory.establish(beaconService);
157
+ return beacon.broadcastSignal(update, secretKey, bitcoin);
158
+ }
159
+ // ─── Private instance wrappers ─────────────────────────────────────────────
160
+ // Delegate to the public statics with bound instance fields for cleaner
161
+ // advance/provide code.
162
+ #construct() {
163
+ return _a.construct(this.#sourceDocument, this.#patches, this.#sourceVersionId);
164
+ }
165
+ #sign(secretKey) {
166
+ return _a.sign(this.#sourceDocument.id, this.#unsignedUpdate, this.#verificationMethod, secretKey);
167
+ }
168
+ // ─── State machine ─────────────────────────────────────────────────────────
169
+ /**
170
+ * Advance the state machine. Returns either:
171
+ * - `{ status: 'action-required', needs }` — caller must provide data via {@link provide}
172
+ * - `{ status: 'complete', result }` — update is signed and broadcast
173
+ */
174
+ advance() {
175
+ while (true) {
176
+ switch (this.#phase) {
177
+ // Phase: Construct
178
+ // Build the unsigned update from source doc + patches. Pure, synchronous.
179
+ case UpdaterPhase.Construct: {
180
+ this.#unsignedUpdate = this.#construct();
181
+ this.#phase = UpdaterPhase.Sign;
182
+ continue;
183
+ }
184
+ // Phase: Sign
185
+ // Emit NeedSigningKey — the caller supplies the secret key (or a KMS signature).
186
+ case UpdaterPhase.Sign: {
187
+ return {
188
+ status: 'action-required',
189
+ needs: [{
190
+ kind: 'NeedSigningKey',
191
+ verificationMethodId: this.#verificationMethod.id,
192
+ unsignedUpdate: this.#unsignedUpdate,
193
+ }],
194
+ };
195
+ }
196
+ // Phase: Fund
197
+ // Emit NeedFunding with the beacon address. The caller checks UTXOs,
198
+ // funds the address if needed, and provides to continue.
199
+ case UpdaterPhase.Fund: {
200
+ const beaconAddress = this.#beaconService.serviceEndpoint.replace('bitcoin:', '');
201
+ return {
202
+ status: 'action-required',
203
+ needs: [{
204
+ kind: 'NeedFunding',
205
+ beaconAddress,
206
+ beaconService: this.#beaconService,
207
+ }],
208
+ };
209
+ }
210
+ // Phase: Broadcast
211
+ // Emit NeedBroadcast with the signed update + beacon service. The caller performs
212
+ // the actual on-chain announcement (or hands off to the aggregation protocol).
213
+ case UpdaterPhase.Broadcast: {
214
+ return {
215
+ status: 'action-required',
216
+ needs: [{
217
+ kind: 'NeedBroadcast',
218
+ beaconService: this.#beaconService,
219
+ signedUpdate: this.#signedUpdate,
220
+ }],
221
+ };
222
+ }
223
+ // Phase: Complete
224
+ case UpdaterPhase.Complete: {
225
+ return {
226
+ status: 'complete',
227
+ result: { signedUpdate: this.#signedUpdate },
228
+ };
229
+ }
230
+ }
231
+ }
232
+ }
233
+ provide(need, data) {
234
+ switch (need.kind) {
235
+ case 'NeedSigningKey': {
236
+ if (this.#phase !== UpdaterPhase.Sign) {
237
+ throw new UpdateError(`Cannot provide NeedSigningKey: updater phase is ${this.#phase}, expected Sign.`, INVALID_DID_UPDATE, { phase: this.#phase });
238
+ }
239
+ if (!data) {
240
+ throw new UpdateError('NeedSigningKey requires secret key bytes.', INVALID_DID_UPDATE);
241
+ }
242
+ if (!this.#unsignedUpdate) {
243
+ throw new UpdateError('Internal error: unsigned update missing in Sign phase.', INVALID_DID_UPDATE);
244
+ }
245
+ this.#signedUpdate = this.#sign(data);
246
+ this.#phase = UpdaterPhase.Fund;
247
+ break;
248
+ }
249
+ case 'NeedFunding': {
250
+ if (this.#phase !== UpdaterPhase.Fund) {
251
+ throw new UpdateError(`Cannot provide NeedFunding: updater phase is ${this.#phase}, expected Fund.`, INVALID_DID_UPDATE, { phase: this.#phase });
252
+ }
253
+ // Caller has confirmed funding (or it was already funded). Continue.
254
+ this.#phase = UpdaterPhase.Broadcast;
255
+ break;
256
+ }
257
+ case 'NeedBroadcast': {
258
+ if (this.#phase !== UpdaterPhase.Broadcast) {
259
+ throw new UpdateError(`Cannot provide NeedBroadcast: updater phase is ${this.#phase}, expected Broadcast.`, INVALID_DID_UPDATE, { phase: this.#phase });
260
+ }
261
+ // Caller has broadcast externally. Transition to Complete.
262
+ this.#phase = UpdaterPhase.Complete;
263
+ break;
264
+ }
265
+ }
266
+ }
267
+ }
268
+ _a = Updater;
269
+ //# sourceMappingURL=updater.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updater.js","sourceRoot":"","sources":["../../../src/core/updater.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAAE,eAAe,EAA8E,MAAM,wBAAwB,CAAC;AACrI,OAAO,EAAE,WAAW,EAAqD,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAuEpD;;;GAGG;AACH,IAAK,YAMJ;AAND,WAAK,YAAY;IACf,uCAAuB,CAAA;IACvB,6BAAkB,CAAA;IAClB,6BAAkB,CAAA;IAClB,uCAAuB,CAAA;IACvB,qCAAsB,CAAA;AACxB,CAAC,EANI,YAAY,KAAZ,YAAY,QAMhB;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAO,OAAO;IAClB,MAAM,GAAiB,YAAY,CAAC,SAAS,CAAC;IACrC,eAAe,CAAmB;IAClC,QAAQ,CAAmB;IAC3B,gBAAgB,CAAS;IACzB,mBAAmB,CAAwB;IAC3C,cAAc,CAAgB;IAEvC,eAAe,GAA+B,IAAI,CAAC;IACnD,aAAa,GAA6B,IAAI,CAAC;IAE/C;;OAEG;IACH,YAAY,MAAqB;QAC/B,IAAI,CAAC,eAAe,GAAG,MAAM,C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;gBACnB,IAAG,IAAI,CAAC,MAAM,KAAK,YAAY,CAAC,IAAI,EAAE,CAAC;oBACrC,MAAM,IAAI,WAAW,CACnB,gDAAgD,IAAI,CAAC,MAAM,kBAAkB,EAC7E,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAC3C,CAAC;gBACJ,CAAC;gBACD,qEAAqE;gBACrE,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC;gBACrC,MAAM;YACR,CAAC;YAED,KAAK,eAAe,CAAC,CAAC,CAAC;gBACrB,IAAG,IAAI,CAAC,MAAM,KAAK,YAAY,CAAC,SAAS,EAAE,CAAC;oBAC1C,MAAM,IAAI,WAAW,CACnB,kDAAkD,IAAI,CAAC,MAAM,uBAAuB,EACpF,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAC3C,CAAC;gBACJ,CAAC;gBACD,2DAA2D;gBAC3D,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC;gBACpC,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -1,11 +1,10 @@
1
1
  import { IdentifierHrp, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, METHOD_NOT_SUPPORTED, MethodError, UpdateError } from '@did-btcr2/common';
2
2
  import { Did, DidError, DidErrorCode } from '@web5/dids';
3
3
  import * as ecc from '@bitcoinerlab/secp256k1';
4
- import { hexToBytes } from '@noble/hashes/utils';
5
4
  import { initEccLib } from 'bitcoinjs-lib';
6
5
  import { Identifier } from './core/identifier.js';
7
6
  import { Resolver } from './core/resolver.js';
8
- import { Update } from './core/update.js';
7
+ import { Updater } from './core/updater.js';
9
8
  import { Appendix } from './utils/appendix.js';
10
9
  /** Initialize secp256k1 ECC library */
11
10
  initEccLib(ecc);
@@ -92,34 +91,29 @@ export class DidBtcr2 {
92
91
  });
93
92
  }
94
93
  /**
95
- * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#read | 7.3 Update}.
96
- * See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
97
- * See {@link Update | Update (class)} for class implementation.
94
+ * Entry point for section {@link https://dcdpr.github.io/did-btcr2/#update | 7.3 Update}.
98
95
  *
99
- * BTCR2 DID documents can be updated by anchoring BTCR2 Updates to Bitcoin transactions. These transactions MAY be
100
- * published to the Bitcoin network. Any property in the DID document may be updated except the id. Doing so would
101
- * invalidate the DID document.
102
- * @param params An object containing the parameters for the update operation.
96
+ * Factory method that validates the update parameters and returns a sans-I/O
97
+ * {@link Updater} state machine. The caller drives the updater through its
98
+ * phases (Construct Sign → Broadcast → Complete) by calling `advance()` and
99
+ * `provide()`. The method package performs **zero I/O** signing key retrieval
100
+ * (or KMS delegation) and the on-chain broadcast are the caller's responsibility.
101
+ *
102
+ * For a fully-wired version with Bitcoin broadcast and key handling, see
103
+ * `DidMethodApi.update()` in `@did-btcr2/api`.
104
+ *
105
+ * @param params Update construction parameters.
103
106
  * @param {Btcr2DidDocument} params.sourceDocument The DID document being updated.
104
- * @param {PatchOperation[]} params.patches The array of JSON Patch operations to apply to the sourceDocument.
105
- * @param {string} params.sourceVersionId The version ID before applying the update.
106
- * @param {string} params.verificationMethodId The verificationMethod ID to sign the update with.
107
- * @param {string} params.beaconId The beacon ID associated with the update.
108
- * @param {KeyBytes | HexString} [params.signingMaterial] Optional signing material (key bytes or hex string).
109
- * @param {BitcoinConnection} [params.bitcoin] Optional Bitcoin network connection for announcing the update. If not provided, a default connection will be initialized.
110
- * @return {Promise<SignedBTCR2Update>} Promise resolving to the signed BTCR2 update.
111
- * @throws {UpdateError} if no verificationMethod, verificationMethod type is not `Multikey` or the publicKeyMultibase
112
- * header is not `zQ3s`
107
+ * @param {PatchOperation[]} params.patches The JSON Patch operations to apply.
108
+ * @param {number} params.sourceVersionId The version ID before applying the update.
109
+ * @param {string} params.verificationMethodId The verification method ID to sign with.
110
+ * @param {string} params.beaconId The beacon service ID to broadcast through.
111
+ * @returns {Updater} A sans-I/O state machine for driving the update.
112
+ * @throws {UpdateError} If the verification method is not authorized, not found,
113
+ * not of type `Multikey`, or does not have a `zQ3s` publicKeyMultibase prefix.
114
+ * Also throws if the beacon service is not found.
113
115
  */
114
- static async update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, signingMaterial, bitcoin, }) {
115
- // If no signingMaterial provided, throw an UpdateError with INVALID_DID_UPDATE.
116
- if (!signingMaterial) {
117
- throw new UpdateError('Missing signing material for update', INVALID_DID_UPDATE, { signingMaterial });
118
- }
119
- // Convert signingMaterial to bytes if it's a hex string
120
- const secretKey = typeof signingMaterial === 'string'
121
- ? hexToBytes(signingMaterial)
122
- : signingMaterial;
116
+ static update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, }) {
123
117
  // Validate that the verificationMethodId is authorized for capabilityInvocation
124
118
  if (!sourceDocument.capabilityInvocation?.some(vr => vr === verificationMethodId)) {
125
119
  throw new UpdateError('Invalid verificationMethodId: not authorized for capabilityInvocation', INVALID_DID_DOCUMENT, sourceDocument);
@@ -138,28 +132,22 @@ export class DidBtcr2 {
138
132
  if (verificationMethod.publicKeyMultibase?.slice(0, 4) !== 'zQ3s') {
139
133
  throw new UpdateError('Invalid verificationMethodId: publicKeyMultibase prefix must start with "zQ3s"', INVALID_DID_DOCUMENT, verificationMethod);
140
134
  }
141
- // Construct an unsigned update following the BTCR2 Update construction algorithm
142
- const update = Update.construct(sourceDocument, patches, sourceVersionId);
143
- // Sign the unsigned update using the specified verification method
144
- const signed = Update.sign(sourceDocument.id, update, verificationMethod, secretKey);
145
- // Filter sourceDocument services to get beaconServices matching beaconIds
135
+ // Find the beacon service matching the given beaconId
146
136
  const beaconService = sourceDocument.service
147
137
  .filter((service) => service.id === beaconId)
148
138
  .filter((service) => !!service)
149
139
  .shift();
150
- // If no matching beacon service found, throw an UpdateError with INVALID_DID_UPDATE.
151
140
  if (!beaconService) {
152
141
  throw new UpdateError('No beacon service found for provided beaconId', INVALID_DID_UPDATE, { sourceDocument, beaconId });
153
142
  }
154
- // Require an explicit bitcoin connection no silent env-var fallback
155
- if (!bitcoin) {
156
- throw new UpdateError('Bitcoin connection required for update. Pass a configured `bitcoin` parameter '
157
- + 'or use DidBtcr2Api which injects it automatically.', INVALID_DID_UPDATE, { beaconId });
158
- }
159
- // Announce the signed update to the blockchain using the specified beacon(s)
160
- await Update.announce(beaconService, signed, secretKey, bitcoin);
161
- // Return signed update if announced successfully
162
- return signed;
143
+ // Return a sans-I/O state machine the caller will drive
144
+ return new Updater({
145
+ sourceDocument,
146
+ patches,
147
+ sourceVersionId,
148
+ verificationMethod,
149
+ beaconService,
150
+ });
163
151
  }
164
152
  /**
165
153
  * Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
@@ -1 +1 @@
1
- {"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,GAAG,EACH,QAAQ,EACR,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAY/C,uCAAuC;AACvC,UAAU,CAAC,GAAG,CAAC,CAAC;AAEhB;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,QAAQ;IACnB;;OA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,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;QAEF,qDAAqD;QACrD,IAAI,CAAC,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,aAAa,EAC1B,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,kBAA2C,CAAC;IACrD,CAAC"}
package/dist/esm/index.js CHANGED
@@ -13,6 +13,7 @@ export * from './core/beacon/beacon.js';
13
13
  export * from './core/beacon/cas-beacon.js';
14
14
  export * from './core/beacon/error.js';
15
15
  export * from './core/beacon/factory.js';
16
+ export * from './core/beacon/fee-estimator.js';
16
17
  export * from './core/beacon/interfaces.js';
17
18
  export * from './core/beacon/signal-discovery.js';
18
19
  export * from './core/beacon/singleton-beacon.js';
@@ -23,7 +24,7 @@ export * from './core/identifier.js';
23
24
  export * from './core/interfaces.js';
24
25
  export * from './core/resolver.js';
25
26
  export * from './core/types.js';
26
- export * from './core/update.js';
27
+ export * from './core/updater.js';
27
28
  // Utils
28
29
  export * from './utils/appendix.js';
29
30
  export * from './utils/did-document-builder.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AAEnD,UAAU;AACV,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cA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+65,11 @@ export interface AggregationParticipantRunnerOptions {
65
65
  * keys: myKeys,
66
66
  * shouldJoin: async (advert) => advert.beaconType === 'CASBeacon',
67
67
  * onProvideUpdate: async ({ beaconAddress }) => {
68
+ <<<<<<< Updated upstream
68
69
  * return Update.sign(myDid, unsigned, vm, secretKey);
70
+ =======
71
+ * return Updater.sign(myDid, unsigned, vm, secretKey);
72
+ >>>>>>> Stashed changes
69
73
  * },
70
74
  * });
71
75
  *
@@ -1 +1 @@
1
- {"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpE,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEjC,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEzF,oDAAoD;AACpD,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE/F,MAAM,WAAW,mCAAmC;IAClD,4BAA4B;IAC5B,SAAS,EAAE,SAAS,CAAC;IAErB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,eAAe,EAAE,eAAe,CAAC;IAEjC;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB,CAAC,4BAA4B,CAAC;;IAC/F,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAY7B,OAAO,EAAE,mCAAmC;IAYxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,+DAA+D;IAC/D,IAAI,IAAI,IAAI;IAIZ;;;OAGG;WACU,SAAS,CACpB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CA+MxD"}
1
+ {"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,mBAAm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iB,CAAC,4BAA4B,CAAC;;IAC/F,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAY7B,OAAO,EAAE,mCAAmC;IAYxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,+DAA+D;IAC/D,IAAI,IAAI,IAAI;IAIZ;;;OAGG;WACU,SAAS,CACpB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CA+MxD"}
@@ -0,0 +1,178 @@
1
+ import type { BitcoinConnection } from '@did-btcr2/bitcoin';
2
+ import type { KeyBytes, PatchOperation } from '@did-btcr2/common';
3
+ import { type SignedBTCR2Update, type UnsignedBTCR2Update } from '@did-btcr2/cryptosuite';
4
+ import { type Btcr2DidDocument, type DidVerificationMethod } from '../utils/did-document.js';
5
+ import type { BeaconService } from './beacon/interfaces.js';
6
+ /**
7
+ * The updater needs the caller to supply a signing key (or a KMS-backed signature)
8
+ * for the given verification method. The unsigned update is attached so the caller
9
+ * can inspect it before producing a signature.
10
+ */
11
+ export interface NeedSigningKey {
12
+ readonly kind: 'NeedSigningKey';
13
+ /** The verification method ID that requires a signing key. */
14
+ readonly verificationMethodId: string;
15
+ /** The unsigned update that will be signed. */
16
+ readonly unsignedUpdate: UnsignedBTCR2Update;
17
+ }
18
+ /**
19
+ * The updater needs the caller to ensure the beacon address is funded before
20
+ * broadcasting. The caller checks the beacon address for UTXOs, funds it if
21
+ * needed, and then calls `updater.provide(need)` to continue.
22
+ *
23
+ * If the beacon is already funded, the caller can provide immediately (no-op).
24
+ */
25
+ export interface NeedFunding {
26
+ readonly kind: 'NeedFunding';
27
+ /** The Bitcoin address that must have a spendable UTXO for broadcast. */
28
+ readonly beaconAddress: string;
29
+ /** The beacon service this address belongs to. */
30
+ readonly beaconService: BeaconService;
31
+ }
32
+ /**
33
+ * The updater needs the caller to broadcast the signed update via the beacon.
34
+ *
35
+ * The caller decides how: for single-party beacons, call
36
+ * `Updater.announce(beaconService, signedUpdate, secretKey, bitcoin)` or
37
+ * `BeaconFactory.establish(beaconService).broadcastSignal(...)`. For multi-party
38
+ * aggregate beacons, hand off to the aggregation protocol.
39
+ *
40
+ * After the broadcast succeeds, the caller calls `updater.provide(need)` (with no
41
+ * data) to transition the updater to Complete.
42
+ */
43
+ export interface NeedBroadcast {
44
+ readonly kind: 'NeedBroadcast';
45
+ /** The beacon service to broadcast through. Inspect `beaconService.type` to decide the path. */
46
+ readonly beaconService: BeaconService;
47
+ /** The signed update ready for broadcast. */
48
+ readonly signedUpdate: SignedBTCR2Update;
49
+ }
50
+ /** Discriminated union of all data needs the updater may request from the caller. */
51
+ export type UpdaterDataNeed = NeedSigningKey | NeedFunding | NeedBroadcast;
52
+ /**
53
+ * The result returned by the updater when it reaches the Complete phase.
54
+ */
55
+ export interface UpdaterResult {
56
+ /** The signed update that was constructed, signed, and broadcast. */
57
+ signedUpdate: SignedBTCR2Update;
58
+ }
59
+ /**
60
+ * Output of {@link Updater.advance}. Either the updater needs data from the
61
+ * caller, or the update is complete.
62
+ */
63
+ export type UpdaterState = {
64
+ status: 'action-required';
65
+ needs: ReadonlyArray<UpdaterDataNeed>;
66
+ } | {
67
+ status: 'complete';
68
+ result: UpdaterResult;
69
+ };
70
+ /**
71
+ * Parameters for constructing an {@link Updater}. Built by
72
+ * {@link https://dcdpr.github.io/did-btcr2/operations/update.html | DidBtcr2.update}.
73
+ */
74
+ export interface UpdaterParams {
75
+ sourceDocument: Btcr2DidDocument;
76
+ patches: PatchOperation[];
77
+ sourceVersionId: number;
78
+ verificationMethod: DidVerificationMethod;
79
+ beaconService: BeaconService;
80
+ }
81
+ /**
82
+ * Sans-I/O state machine for did:btcr2 updates — the counterpart to {@link Resolver}.
83
+ *
84
+ * Created by {@link DidBtcr2.update} (the factory). The caller drives the update by
85
+ * repeatedly calling {@link advance} and {@link provide}:
86
+ *
87
+ * ```typescript
88
+ * const updater = DidBtcr2.update({ sourceDocument, patches, ... });
89
+ * let state = updater.advance();
90
+ *
91
+ * while(state.status === 'action-required') {
92
+ * for(const need of state.needs) {
93
+ * switch(need.kind) {
94
+ * case 'NeedSigningKey':
95
+ * updater.provide(need, secretKeyBytes);
96
+ * break;
97
+ * case 'NeedFunding':
98
+ * // Check UTXOs at need.beaconAddress, fund if needed
99
+ * updater.provide(need);
100
+ * break;
101
+ * case 'NeedBroadcast':
102
+ * await Updater.announce(need.beaconService, need.signedUpdate, secretKey, bitcoin);
103
+ * updater.provide(need);
104
+ * break;
105
+ * }
106
+ * }
107
+ * state = updater.advance();
108
+ * }
109
+ *
110
+ * const { signedUpdate } = state.result;
111
+ * ```
112
+ *
113
+ * The Updater performs **zero I/O**. All external work (signing with a KMS or raw
114
+ * key, funding checks, Bitcoin transaction construction, broadcast) flows through
115
+ * the advance/provide protocol. This mirrors the {@link Resolver} pattern and makes
116
+ * the update path transport-agnostic and KMS-ready.
117
+ *
118
+ * The class also exposes static utility methods ({@link construct}, {@link sign},
119
+ * {@link announce}) for callers that need direct access to individual update steps
120
+ * outside the state machine (e.g., test vector generation scripts).
121
+ *
122
+ * @class Updater
123
+ */
124
+ export declare class Updater {
125
+ #private;
126
+ /**
127
+ * @internal — Use {@link DidBtcr2.update} to create instances.
128
+ */
129
+ constructor(params: UpdaterParams);
130
+ /**
131
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-unsigned-update | 7.3.b Construct BTCR2 Unsigned Update}.
132
+ *
133
+ * @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
134
+ * @param {PatchOperation[]} patches The JSON Patch operations to apply.
135
+ * @param {number} sourceVersionId The version ID of the source document.
136
+ * @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
137
+ * @throws {UpdateError} If the target document fails DID Core validation.
138
+ */
139
+ static construct(sourceDocument: Btcr2DidDocument, patches: PatchOperation[], sourceVersionId: number): UnsignedBTCR2Update;
140
+ /**
141
+ * Implements subsection {@link http://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-signed-update | 7.3.c Construct BTCR2 Signed Update }.
142
+ *
143
+ * @param {string} did The did-btcr2 identifier to derive the root capability from.
144
+ * @param {UnsignedBTCR2Update} unsignedUpdate The unsigned update to sign.
145
+ * @param {DidVerificationMethod} verificationMethod The verification method for signing.
146
+ * @param {KeyBytes} secretKey The secret key bytes.
147
+ * @returns {SignedBTCR2Update} The signed update with a Data Integrity proof.
148
+ */
149
+ static sign(did: string, unsignedUpdate: UnsignedBTCR2Update, verificationMethod: DidVerificationMethod, secretKey: KeyBytes): SignedBTCR2Update;
150
+ /**
151
+ * Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#announce-did-update | 7.3.d Announce DID Update}.
152
+ * Announces a signed update to the Bitcoin blockchain via the specified beacon.
153
+ *
154
+ * @param {BeaconService} beaconService The beacon service to broadcast through.
155
+ * @param {SignedBTCR2Update} update The signed update to announce.
156
+ * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
157
+ * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
158
+ * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
159
+ */
160
+ static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
161
+ /**
162
+ * Advance the state machine. Returns either:
163
+ * - `{ status: 'action-required', needs }` — caller must provide data via {@link provide}
164
+ * - `{ status: 'complete', result }` — update is signed and broadcast
165
+ */
166
+ advance(): UpdaterState;
167
+ /**
168
+ * Provide data the updater requested in a previous {@link advance} call.
169
+ * Call once per need, then call {@link advance} again to continue.
170
+ *
171
+ * @param need The DataNeed being fulfilled (from the `needs` array).
172
+ * @param data The data payload corresponding to the need kind (omit for NeedFunding/NeedBroadcast).
173
+ */
174
+ provide(need: NeedSigningKey, data: KeyBytes): void;
175
+ provide(need: NeedFunding): void;
176
+ provide(need: NeedBroadcast): void;
177
+ }
178
+ //# sourceMappingURL=updater.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../../src/core/updater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAA6C,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACrI,OAAO,EAAe,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE1G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,gGAAgG;IAChG,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;CAC1C;AAED,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,WAAW,GAAG,aAAa,CAAC;AAE3E;;GAEG;AACH,M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