@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.
- package/README.md +38 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +194 -62
- package/dist/browser.mjs +194 -62
- package/dist/cjs/index.js +201 -68
- package/dist/esm/core/aggregation/runner/participant-runner.js +4 -0
- package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
- package/dist/esm/core/updater.js +269 -0
- package/dist/esm/core/updater.js.map +1 -0
- package/dist/esm/did-btcr2.js +30 -42
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/core/aggregation/runner/participant-runner.d.ts +4 -0
- package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -1
- package/dist/types/core/updater.d.ts +178 -0
- package/dist/types/core/updater.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +23 -23
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/core/aggregation/runner/participant-runner.ts +4 -0
- package/src/core/updater.ts +415 -0
- package/src/did-btcr2.ts +36 -66
- package/src/index.ts +2 -1
- package/dist/esm/core/update.js +0 -112
- package/dist/esm/core/update.js.map +0 -1
- package/dist/types/core/update.d.ts +0 -52
- package/dist/types/core/update.d.ts.map +0 -1
- package/src/core/update.ts +0 -158
package/dist/cjs/index.js
CHANGED
|
@@ -83,11 +83,12 @@ __export(index_exports, {
|
|
|
83
83
|
SigningSessionPhase: () => SigningSessionPhase,
|
|
84
84
|
SingletonBeacon: () => SingletonBeacon,
|
|
85
85
|
SingletonBeaconError: () => SingletonBeaconError,
|
|
86
|
+
StaticFeeEstimator: () => StaticFeeEstimator,
|
|
86
87
|
TransportAdapterError: () => TransportAdapterError,
|
|
87
88
|
TransportError: () => TransportError,
|
|
88
89
|
TransportFactory: () => TransportFactory,
|
|
89
90
|
TypedEventEmitter: () => TypedEventEmitter,
|
|
90
|
-
|
|
91
|
+
Updater: () => Updater,
|
|
91
92
|
VALIDATION_ACK: () => VALIDATION_ACK,
|
|
92
93
|
createAggregatedNonceMessage: () => createAggregatedNonceMessage,
|
|
93
94
|
createAuthorizationRequestMessage: () => createAuthorizationRequestMessage,
|
|
@@ -4155,10 +4156,9 @@ var import_keypair5 = require("@did-btcr2/keypair");
|
|
|
4155
4156
|
var import_common17 = require("@did-btcr2/common");
|
|
4156
4157
|
var import_dids2 = require("@web5/dids");
|
|
4157
4158
|
var ecc = __toESM(require("@bitcoinerlab/secp256k1"), 1);
|
|
4158
|
-
var import_utils9 = require("@noble/hashes/utils");
|
|
4159
4159
|
var import_bitcoinjs_lib7 = require("bitcoinjs-lib");
|
|
4160
4160
|
|
|
4161
|
-
// src/core/
|
|
4161
|
+
// src/core/updater.ts
|
|
4162
4162
|
var import_common16 = require("@did-btcr2/common");
|
|
4163
4163
|
var import_cryptosuite = require("@did-btcr2/cryptosuite");
|
|
4164
4164
|
|
|
@@ -4529,17 +4529,37 @@ var GenesisDocument = class _GenesisDocument extends DidDocument {
|
|
|
4529
4529
|
}
|
|
4530
4530
|
};
|
|
4531
4531
|
|
|
4532
|
-
// src/core/
|
|
4533
|
-
var
|
|
4532
|
+
// src/core/updater.ts
|
|
4533
|
+
var Updater = class _Updater {
|
|
4534
|
+
#phase = "Construct" /* Construct */;
|
|
4535
|
+
#sourceDocument;
|
|
4536
|
+
#patches;
|
|
4537
|
+
#sourceVersionId;
|
|
4538
|
+
#verificationMethod;
|
|
4539
|
+
#beaconService;
|
|
4540
|
+
#unsignedUpdate = null;
|
|
4541
|
+
#signedUpdate = null;
|
|
4542
|
+
/**
|
|
4543
|
+
* @internal — Use {@link DidBtcr2.update} to create instances.
|
|
4544
|
+
*/
|
|
4545
|
+
constructor(params) {
|
|
4546
|
+
this.#sourceDocument = params.sourceDocument;
|
|
4547
|
+
this.#patches = params.patches;
|
|
4548
|
+
this.#sourceVersionId = params.sourceVersionId;
|
|
4549
|
+
this.#verificationMethod = params.verificationMethod;
|
|
4550
|
+
this.#beaconService = params.beaconService;
|
|
4551
|
+
}
|
|
4552
|
+
// ─── Public static utility methods ─────────────────────────────────────────
|
|
4553
|
+
// Used by generate-vector.ts and other scripts that need direct access to
|
|
4554
|
+
// individual update steps outside the state machine flow.
|
|
4534
4555
|
/**
|
|
4535
4556
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-unsigned-update | 7.3.b Construct BTCR2 Unsigned Update}.
|
|
4536
|
-
* This process constructs a BTCR2 Unsigned Update conformant to the spec template.
|
|
4537
4557
|
*
|
|
4538
4558
|
* @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
|
|
4539
|
-
* @param {PatchOperation[]} patches The
|
|
4559
|
+
* @param {PatchOperation[]} patches The JSON Patch operations to apply.
|
|
4540
4560
|
* @param {number} sourceVersionId The version ID of the source document.
|
|
4541
4561
|
* @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
|
|
4542
|
-
* @throws {UpdateError}
|
|
4562
|
+
* @throws {UpdateError} If the target document fails DID Core validation.
|
|
4543
4563
|
*/
|
|
4544
4564
|
static construct(sourceDocument, patches, sourceVersionId) {
|
|
4545
4565
|
const unsignedUpdate = {
|
|
@@ -4569,13 +4589,12 @@ var Update = class {
|
|
|
4569
4589
|
}
|
|
4570
4590
|
/**
|
|
4571
4591
|
* Implements subsection {@link http://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-signed-update | 7.3.c Construct BTCR2 Signed Update }.
|
|
4572
|
-
* This process constructs a BTCR2 Signed Update from a BTCR2 Unsigned Update.
|
|
4573
4592
|
*
|
|
4574
|
-
* @param {string} did The did-btcr2 identifier to derive the root capability from
|
|
4575
|
-
* @param {UnsignedBTCR2Update} unsignedUpdate The
|
|
4576
|
-
* @param {DidVerificationMethod} verificationMethod The
|
|
4577
|
-
* @
|
|
4578
|
-
* @
|
|
4593
|
+
* @param {string} did The did-btcr2 identifier to derive the root capability from.
|
|
4594
|
+
* @param {UnsignedBTCR2Update} unsignedUpdate The unsigned update to sign.
|
|
4595
|
+
* @param {DidVerificationMethod} verificationMethod The verification method for signing.
|
|
4596
|
+
* @param {KeyBytes} secretKey The secret key bytes.
|
|
4597
|
+
* @returns {SignedBTCR2Update} The signed update with a Data Integrity proof.
|
|
4579
4598
|
*/
|
|
4580
4599
|
static sign(did, unsignedUpdate, verificationMethod, secretKey) {
|
|
4581
4600
|
const controller = verificationMethod.controller;
|
|
@@ -4600,17 +4619,141 @@ var Update = class {
|
|
|
4600
4619
|
}
|
|
4601
4620
|
/**
|
|
4602
4621
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#announce-did-update | 7.3.d Announce DID Update}.
|
|
4603
|
-
*
|
|
4604
|
-
*
|
|
4605
|
-
* @param {
|
|
4606
|
-
* @param {
|
|
4607
|
-
* @
|
|
4608
|
-
* @
|
|
4622
|
+
* Announces a signed update to the Bitcoin blockchain via the specified beacon.
|
|
4623
|
+
*
|
|
4624
|
+
* @param {BeaconService} beaconService The beacon service to broadcast through.
|
|
4625
|
+
* @param {SignedBTCR2Update} update The signed update to announce.
|
|
4626
|
+
* @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
|
|
4627
|
+
* @param {BitcoinConnection} bitcoin The Bitcoin network connection.
|
|
4628
|
+
* @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
|
|
4609
4629
|
*/
|
|
4610
4630
|
static async announce(beaconService, update, secretKey, bitcoin) {
|
|
4611
4631
|
const beacon = BeaconFactory.establish(beaconService);
|
|
4612
|
-
|
|
4613
|
-
|
|
4632
|
+
return beacon.broadcastSignal(update, secretKey, bitcoin);
|
|
4633
|
+
}
|
|
4634
|
+
// ─── Private instance wrappers ─────────────────────────────────────────────
|
|
4635
|
+
// Delegate to the public statics with bound instance fields for cleaner
|
|
4636
|
+
// advance/provide code.
|
|
4637
|
+
#construct() {
|
|
4638
|
+
return _Updater.construct(this.#sourceDocument, this.#patches, this.#sourceVersionId);
|
|
4639
|
+
}
|
|
4640
|
+
#sign(secretKey) {
|
|
4641
|
+
return _Updater.sign(this.#sourceDocument.id, this.#unsignedUpdate, this.#verificationMethod, secretKey);
|
|
4642
|
+
}
|
|
4643
|
+
// ─── State machine ─────────────────────────────────────────────────────────
|
|
4644
|
+
/**
|
|
4645
|
+
* Advance the state machine. Returns either:
|
|
4646
|
+
* - `{ status: 'action-required', needs }` — caller must provide data via {@link provide}
|
|
4647
|
+
* - `{ status: 'complete', result }` — update is signed and broadcast
|
|
4648
|
+
*/
|
|
4649
|
+
advance() {
|
|
4650
|
+
while (true) {
|
|
4651
|
+
switch (this.#phase) {
|
|
4652
|
+
// Phase: Construct
|
|
4653
|
+
// Build the unsigned update from source doc + patches. Pure, synchronous.
|
|
4654
|
+
case "Construct" /* Construct */: {
|
|
4655
|
+
this.#unsignedUpdate = this.#construct();
|
|
4656
|
+
this.#phase = "Sign" /* Sign */;
|
|
4657
|
+
continue;
|
|
4658
|
+
}
|
|
4659
|
+
// Phase: Sign
|
|
4660
|
+
// Emit NeedSigningKey — the caller supplies the secret key (or a KMS signature).
|
|
4661
|
+
case "Sign" /* Sign */: {
|
|
4662
|
+
return {
|
|
4663
|
+
status: "action-required",
|
|
4664
|
+
needs: [{
|
|
4665
|
+
kind: "NeedSigningKey",
|
|
4666
|
+
verificationMethodId: this.#verificationMethod.id,
|
|
4667
|
+
unsignedUpdate: this.#unsignedUpdate
|
|
4668
|
+
}]
|
|
4669
|
+
};
|
|
4670
|
+
}
|
|
4671
|
+
// Phase: Fund
|
|
4672
|
+
// Emit NeedFunding with the beacon address. The caller checks UTXOs,
|
|
4673
|
+
// funds the address if needed, and provides to continue.
|
|
4674
|
+
case "Fund" /* Fund */: {
|
|
4675
|
+
const beaconAddress = this.#beaconService.serviceEndpoint.replace("bitcoin:", "");
|
|
4676
|
+
return {
|
|
4677
|
+
status: "action-required",
|
|
4678
|
+
needs: [{
|
|
4679
|
+
kind: "NeedFunding",
|
|
4680
|
+
beaconAddress,
|
|
4681
|
+
beaconService: this.#beaconService
|
|
4682
|
+
}]
|
|
4683
|
+
};
|
|
4684
|
+
}
|
|
4685
|
+
// Phase: Broadcast
|
|
4686
|
+
// Emit NeedBroadcast with the signed update + beacon service. The caller performs
|
|
4687
|
+
// the actual on-chain announcement (or hands off to the aggregation protocol).
|
|
4688
|
+
case "Broadcast" /* Broadcast */: {
|
|
4689
|
+
return {
|
|
4690
|
+
status: "action-required",
|
|
4691
|
+
needs: [{
|
|
4692
|
+
kind: "NeedBroadcast",
|
|
4693
|
+
beaconService: this.#beaconService,
|
|
4694
|
+
signedUpdate: this.#signedUpdate
|
|
4695
|
+
}]
|
|
4696
|
+
};
|
|
4697
|
+
}
|
|
4698
|
+
// Phase: Complete
|
|
4699
|
+
case "Complete" /* Complete */: {
|
|
4700
|
+
return {
|
|
4701
|
+
status: "complete",
|
|
4702
|
+
result: { signedUpdate: this.#signedUpdate }
|
|
4703
|
+
};
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
provide(need, data) {
|
|
4709
|
+
switch (need.kind) {
|
|
4710
|
+
case "NeedSigningKey": {
|
|
4711
|
+
if (this.#phase !== "Sign" /* Sign */) {
|
|
4712
|
+
throw new import_common16.UpdateError(
|
|
4713
|
+
`Cannot provide NeedSigningKey: updater phase is ${this.#phase}, expected Sign.`,
|
|
4714
|
+
import_common16.INVALID_DID_UPDATE,
|
|
4715
|
+
{ phase: this.#phase }
|
|
4716
|
+
);
|
|
4717
|
+
}
|
|
4718
|
+
if (!data) {
|
|
4719
|
+
throw new import_common16.UpdateError(
|
|
4720
|
+
"NeedSigningKey requires secret key bytes.",
|
|
4721
|
+
import_common16.INVALID_DID_UPDATE
|
|
4722
|
+
);
|
|
4723
|
+
}
|
|
4724
|
+
if (!this.#unsignedUpdate) {
|
|
4725
|
+
throw new import_common16.UpdateError(
|
|
4726
|
+
"Internal error: unsigned update missing in Sign phase.",
|
|
4727
|
+
import_common16.INVALID_DID_UPDATE
|
|
4728
|
+
);
|
|
4729
|
+
}
|
|
4730
|
+
this.#signedUpdate = this.#sign(data);
|
|
4731
|
+
this.#phase = "Fund" /* Fund */;
|
|
4732
|
+
break;
|
|
4733
|
+
}
|
|
4734
|
+
case "NeedFunding": {
|
|
4735
|
+
if (this.#phase !== "Fund" /* Fund */) {
|
|
4736
|
+
throw new import_common16.UpdateError(
|
|
4737
|
+
`Cannot provide NeedFunding: updater phase is ${this.#phase}, expected Fund.`,
|
|
4738
|
+
import_common16.INVALID_DID_UPDATE,
|
|
4739
|
+
{ phase: this.#phase }
|
|
4740
|
+
);
|
|
4741
|
+
}
|
|
4742
|
+
this.#phase = "Broadcast" /* Broadcast */;
|
|
4743
|
+
break;
|
|
4744
|
+
}
|
|
4745
|
+
case "NeedBroadcast": {
|
|
4746
|
+
if (this.#phase !== "Broadcast" /* Broadcast */) {
|
|
4747
|
+
throw new import_common16.UpdateError(
|
|
4748
|
+
`Cannot provide NeedBroadcast: updater phase is ${this.#phase}, expected Broadcast.`,
|
|
4749
|
+
import_common16.INVALID_DID_UPDATE,
|
|
4750
|
+
{ phase: this.#phase }
|
|
4751
|
+
);
|
|
4752
|
+
}
|
|
4753
|
+
this.#phase = "Complete" /* Complete */;
|
|
4754
|
+
break;
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4614
4757
|
}
|
|
4615
4758
|
};
|
|
4616
4759
|
|
|
@@ -4680,42 +4823,35 @@ var DidBtcr2 = class {
|
|
|
4680
4823
|
});
|
|
4681
4824
|
}
|
|
4682
4825
|
/**
|
|
4683
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#
|
|
4684
|
-
*
|
|
4685
|
-
*
|
|
4826
|
+
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#update | 7.3 Update}.
|
|
4827
|
+
*
|
|
4828
|
+
* Factory method that validates the update parameters and returns a sans-I/O
|
|
4829
|
+
* {@link Updater} state machine. The caller drives the updater through its
|
|
4830
|
+
* phases (Construct → Sign → Broadcast → Complete) by calling `advance()` and
|
|
4831
|
+
* `provide()`. The method package performs **zero I/O** — signing key retrieval
|
|
4832
|
+
* (or KMS delegation) and the on-chain broadcast are the caller's responsibility.
|
|
4686
4833
|
*
|
|
4687
|
-
*
|
|
4688
|
-
*
|
|
4689
|
-
*
|
|
4690
|
-
* @param params
|
|
4834
|
+
* For a fully-wired version with Bitcoin broadcast and key handling, see
|
|
4835
|
+
* `DidMethodApi.update()` in `@did-btcr2/api`.
|
|
4836
|
+
*
|
|
4837
|
+
* @param params Update construction parameters.
|
|
4691
4838
|
* @param {Btcr2DidDocument} params.sourceDocument The DID document being updated.
|
|
4692
|
-
* @param {PatchOperation[]} params.patches The
|
|
4693
|
-
* @param {
|
|
4694
|
-
* @param {string} params.verificationMethodId The
|
|
4695
|
-
* @param {string} params.beaconId The beacon ID
|
|
4696
|
-
* @
|
|
4697
|
-
* @
|
|
4698
|
-
*
|
|
4699
|
-
*
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
static async update({
|
|
4839
|
+
* @param {PatchOperation[]} params.patches The JSON Patch operations to apply.
|
|
4840
|
+
* @param {number} params.sourceVersionId The version ID before applying the update.
|
|
4841
|
+
* @param {string} params.verificationMethodId The verification method ID to sign with.
|
|
4842
|
+
* @param {string} params.beaconId The beacon service ID to broadcast through.
|
|
4843
|
+
* @returns {Updater} A sans-I/O state machine for driving the update.
|
|
4844
|
+
* @throws {UpdateError} If the verification method is not authorized, not found,
|
|
4845
|
+
* not of type `Multikey`, or does not have a `zQ3s` publicKeyMultibase prefix.
|
|
4846
|
+
* Also throws if the beacon service is not found.
|
|
4847
|
+
*/
|
|
4848
|
+
static update({
|
|
4703
4849
|
sourceDocument,
|
|
4704
4850
|
patches,
|
|
4705
4851
|
sourceVersionId,
|
|
4706
4852
|
verificationMethodId,
|
|
4707
|
-
beaconId
|
|
4708
|
-
signingMaterial,
|
|
4709
|
-
bitcoin
|
|
4853
|
+
beaconId
|
|
4710
4854
|
}) {
|
|
4711
|
-
if (!signingMaterial) {
|
|
4712
|
-
throw new import_common17.UpdateError(
|
|
4713
|
-
"Missing signing material for update",
|
|
4714
|
-
import_common17.INVALID_DID_UPDATE,
|
|
4715
|
-
{ signingMaterial }
|
|
4716
|
-
);
|
|
4717
|
-
}
|
|
4718
|
-
const secretKey = typeof signingMaterial === "string" ? (0, import_utils9.hexToBytes)(signingMaterial) : signingMaterial;
|
|
4719
4855
|
if (!sourceDocument.capabilityInvocation?.some((vr) => vr === verificationMethodId)) {
|
|
4720
4856
|
throw new import_common17.UpdateError(
|
|
4721
4857
|
"Invalid verificationMethodId: not authorized for capabilityInvocation",
|
|
@@ -4745,8 +4881,6 @@ var DidBtcr2 = class {
|
|
|
4745
4881
|
verificationMethod
|
|
4746
4882
|
);
|
|
4747
4883
|
}
|
|
4748
|
-
const update = Update.construct(sourceDocument, patches, sourceVersionId);
|
|
4749
|
-
const signed = Update.sign(sourceDocument.id, update, verificationMethod, secretKey);
|
|
4750
4884
|
const beaconService = sourceDocument.service.filter((service) => service.id === beaconId).filter((service) => !!service).shift();
|
|
4751
4885
|
if (!beaconService) {
|
|
4752
4886
|
throw new import_common17.UpdateError(
|
|
@@ -4755,15 +4889,13 @@ var DidBtcr2 = class {
|
|
|
4755
4889
|
{ sourceDocument, beaconId }
|
|
4756
4890
|
);
|
|
4757
4891
|
}
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
}
|
|
4765
|
-
await Update.announce(beaconService, signed, secretKey, bitcoin);
|
|
4766
|
-
return signed;
|
|
4892
|
+
return new Updater({
|
|
4893
|
+
sourceDocument,
|
|
4894
|
+
patches,
|
|
4895
|
+
sourceVersionId,
|
|
4896
|
+
verificationMethod,
|
|
4897
|
+
beaconService
|
|
4898
|
+
});
|
|
4767
4899
|
}
|
|
4768
4900
|
/**
|
|
4769
4901
|
* Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
|
|
@@ -4795,7 +4927,7 @@ var DidBtcr2 = class {
|
|
|
4795
4927
|
};
|
|
4796
4928
|
|
|
4797
4929
|
// src/core/resolver.ts
|
|
4798
|
-
var
|
|
4930
|
+
var import_utils10 = require("@noble/curves/utils.js");
|
|
4799
4931
|
var Resolver = class _Resolver {
|
|
4800
4932
|
// --- Immutable inputs ---
|
|
4801
4933
|
#didComponents;
|
|
@@ -4862,7 +4994,7 @@ var Resolver = class _Resolver {
|
|
|
4862
4994
|
*/
|
|
4863
4995
|
static external(didComponents, genesisDocument) {
|
|
4864
4996
|
const genesisDocumentHash = (0, import_common18.canonicalHashBytes)(genesisDocument);
|
|
4865
|
-
if (!(0,
|
|
4997
|
+
if (!(0, import_utils10.equalBytes)(didComponents.genesisBytes, genesisDocumentHash)) {
|
|
4866
4998
|
throw new import_common18.ResolveError(
|
|
4867
4999
|
`Initial document mismatch: genesisBytes !== genesisDocumentHash`,
|
|
4868
5000
|
import_common18.INVALID_DID_DOCUMENT,
|
|
@@ -4939,7 +5071,7 @@ var Resolver = class _Resolver {
|
|
|
4939
5071
|
this.confirmDuplicate(update, updateHashHistory);
|
|
4940
5072
|
} else if (update.targetVersionId === currentVersionId + 1) {
|
|
4941
5073
|
const sourceHashBytes = (0, import_common18.decode)(update.sourceHash, "base64urlnopad");
|
|
4942
|
-
if (!(0,
|
|
5074
|
+
if (!(0, import_utils10.equalBytes)(sourceHashBytes, currentDocumentHash)) {
|
|
4943
5075
|
throw new import_common18.ResolveError(
|
|
4944
5076
|
`Hash mismatch: update.sourceHash !== currentDocumentHash`,
|
|
4945
5077
|
import_common18.INVALID_DID_UPDATE,
|
|
@@ -4986,7 +5118,7 @@ var Resolver = class _Resolver {
|
|
|
4986
5118
|
const { proof: _, ...unsignedUpdate } = update;
|
|
4987
5119
|
const unsignedUpdateHash = (0, import_common18.canonicalHashBytes)(unsignedUpdate);
|
|
4988
5120
|
const historicalUpdateHash = updateHashHistory[update.targetVersionId - 2];
|
|
4989
|
-
if (!(0,
|
|
5121
|
+
if (!(0, import_utils10.equalBytes)(historicalUpdateHash, unsignedUpdateHash)) {
|
|
4990
5122
|
throw new import_common18.ResolveError(
|
|
4991
5123
|
`Invalid duplicate: unsigned update hash does not match historical hash`,
|
|
4992
5124
|
import_common18.LATE_PUBLISHING_ERROR,
|
|
@@ -5039,7 +5171,7 @@ var Resolver = class _Resolver {
|
|
|
5039
5171
|
DidDocument.validate(updatedDocument);
|
|
5040
5172
|
const currentDocumentHash = (0, import_common18.canonicalHashBytes)(updatedDocument);
|
|
5041
5173
|
const updateTargetHash = (0, import_common18.decode)(update.targetHash);
|
|
5042
|
-
if (!(0,
|
|
5174
|
+
if (!(0, import_utils10.equalBytes)(updateTargetHash, currentDocumentHash)) {
|
|
5043
5175
|
throw new import_common18.ResolveError(
|
|
5044
5176
|
`Invalid update: update.targetHash !== currentDocumentHash`,
|
|
5045
5177
|
import_common18.INVALID_DID_UPDATE,
|
|
@@ -5308,11 +5440,12 @@ var DidDocumentBuilder = class {
|
|
|
5308
5440
|
SigningSessionPhase,
|
|
5309
5441
|
SingletonBeacon,
|
|
5310
5442
|
SingletonBeaconError,
|
|
5443
|
+
StaticFeeEstimator,
|
|
5311
5444
|
TransportAdapterError,
|
|
5312
5445
|
TransportError,
|
|
5313
5446
|
TransportFactory,
|
|
5314
5447
|
TypedEventEmitter,
|
|
5315
|
-
|
|
5448
|
+
Updater,
|
|
5316
5449
|
VALIDATION_ACK,
|
|
5317
5450
|
createAggregatedNonceMessage,
|
|
5318
5451
|
createAuthorizationRequestMessage,
|
|
@@ -20,7 +20,11 @@ import { TypedEventEmitter } from './typed-emitter.js';
|
|
|
20
20
|
* keys: myKeys,
|
|
21
21
|
* shouldJoin: async (advert) => advert.beaconType === 'CASBeacon',
|
|
22
22
|
* onProvideUpdate: async ({ beaconAddress }) => {
|
|
23
|
+
<<<<<<< Updated upstream
|
|
23
24
|
* return Update.sign(myDid, unsigned, vm, secretKey);
|
|
25
|
+
=======
|
|
26
|
+
* return Updater.sign(myDid, unsigned, vm, secretKey);
|
|
27
|
+
>>>>>>> Stashed changes
|
|
24
28
|
* },
|
|
25
29
|
* });
|
|
26
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant-runner.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAkDvD
|
|
1
|
+
{"version":3,"file":"participant-runner.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAkDvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,OAAO,4BAA6B,SAAQ,iBAA+C;IAC/F,sEAAsE;IAC7D,OAAO,CAAyB;IAEhC,UAAU,CAAY;IACtB,IAAI,CAAS;IACb,WAAW,CAAa;IACxB,gBAAgB,CAAkB;IAClC,eAAe,CAAiB;IAChC,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