@did-btcr2/method 0.24.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +697 -554
- package/dist/browser.mjs +697 -554
- package/dist/cjs/core/beacon/beacon.js.map +1 -1
- package/dist/cjs/core/beacon/cas-beacon.js +119 -7
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -1
- package/dist/cjs/core/beacon/factory.js +1 -1
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/{singleton.js → singleton-beacon.js} +18 -26
- package/dist/cjs/core/beacon/singleton-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/smt-beacon.js +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -1
- package/dist/{esm/core/resolve.js → cjs/core/resolver.js} +241 -93
- package/dist/cjs/core/resolver.js.map +1 -0
- package/dist/cjs/core/update.js +5 -5
- package/dist/cjs/core/update.js.map +1 -1
- package/dist/cjs/did-btcr2.js +34 -92
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/core/beacon/beacon.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +119 -7
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
- package/dist/esm/core/beacon/factory.js +1 -1
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/{singleton.js → singleton-beacon.js} +18 -26
- package/dist/esm/core/beacon/singleton-beacon.js.map +1 -0
- package/dist/esm/core/beacon/smt-beacon.js +1 -1
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
- package/dist/{cjs/core/resolve.js → esm/core/resolver.js} +241 -93
- package/dist/esm/core/resolver.js.map +1 -0
- package/dist/esm/core/update.js +5 -5
- package/dist/esm/core/update.js.map +1 -1
- package/dist/esm/did-btcr2.js +34 -92
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts +9 -4
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +26 -7
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/{singleton.d.ts → singleton-beacon.d.ts} +7 -5
- package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/smt-beacon.d.ts +4 -3
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +5 -15
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/core/resolver.d.ts +167 -0
- package/dist/types/core/resolver.d.ts.map +1 -0
- package/dist/types/core/update.d.ts +3 -3
- package/dist/types/core/update.d.ts.map +1 -1
- package/dist/types/did-btcr2.d.ts +16 -16
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/beacon/beacon.ts +9 -5
- package/src/core/beacon/cas-beacon.ts +156 -10
- package/src/core/beacon/factory.ts +1 -1
- package/src/core/beacon/{singleton.ts → singleton-beacon.ts} +19 -35
- package/src/core/beacon/smt-beacon.ts +4 -3
- package/src/core/interfaces.ts +5 -16
- package/src/core/{resolve.ts → resolver.ts} +355 -130
- package/src/core/update.ts +7 -7
- package/src/did-btcr2.ts +37 -128
- package/src/index.ts +2 -2
- package/dist/cjs/core/beacon/singleton.js.map +0 -1
- package/dist/cjs/core/resolve.js.map +0 -1
- package/dist/esm/core/beacon/singleton.js.map +0 -1
- package/dist/esm/core/resolve.js.map +0 -1
- package/dist/types/core/beacon/singleton.d.ts.map +0 -1
- package/dist/types/core/resolve.d.ts +0 -93
- package/dist/types/core/resolve.d.ts.map +0 -1
|
@@ -1,25 +1,81 @@
|
|
|
1
1
|
import { getNetwork } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { canonicalHash, canonicalize, DateUtils,
|
|
2
|
+
import { canonicalHash, canonicalize, DateUtils, encode as encodeHash, decode as decodeHash, INVALID_DID_DOCUMENT, INVALID_DID_UPDATE, JSONPatch, JSONUtils, LATE_PUBLISHING_ERROR, ResolveError } from '@did-btcr2/common';
|
|
3
3
|
import { BIP340Cryptosuite, BIP340DataIntegrityProof, SchnorrMultikey } from '@did-btcr2/cryptosuite';
|
|
4
4
|
import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
5
|
-
import { hex } from '@scure/base';
|
|
6
5
|
import { DidBtcr2 } from '../did-btcr2.js';
|
|
7
6
|
import { Appendix } from '../utils/appendix.js';
|
|
8
7
|
import { DidDocument, ID_PLACEHOLDER_VALUE } from '../utils/did-document.js';
|
|
9
8
|
import { BeaconFactory } from './beacon/factory.js';
|
|
10
|
-
import { BeaconSignalDiscovery } from './beacon/signal-discovery.js';
|
|
11
9
|
import { BeaconUtils } from './beacon/utils.js';
|
|
12
10
|
import { Identifier } from './identifier.js';
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Resolving a did:btcr2 identifier iteratively builds a DID document by applying BTCR2 Updates
|
|
16
|
-
* to an Initial DID Document that have been committed to the Bitcoin blockchain by Authorized
|
|
17
|
-
* Beacon Signals. The Initial DID Document is either deterministically created from the DID or
|
|
18
|
-
* provided by Sidecar Data.
|
|
19
|
-
* @class Resolve
|
|
20
|
-
* @type {Resolve}
|
|
12
|
+
* Different possible Resolver states representing phases in the resolution process.
|
|
21
13
|
*/
|
|
22
|
-
|
|
14
|
+
var ResolverPhase;
|
|
15
|
+
(function (ResolverPhase) {
|
|
16
|
+
ResolverPhase["GenesisDocument"] = "GenesisDocument";
|
|
17
|
+
ResolverPhase["BeaconDiscovery"] = "BeaconDiscovery";
|
|
18
|
+
ResolverPhase["BeaconProcess"] = "BeaconProcess";
|
|
19
|
+
ResolverPhase["ApplyUpdates"] = "ApplyUpdates";
|
|
20
|
+
ResolverPhase["Complete"] = "Complete";
|
|
21
|
+
})(ResolverPhase || (ResolverPhase = {}));
|
|
22
|
+
/**
|
|
23
|
+
* Sans-I/O state machine for did:btcr2 resolution.
|
|
24
|
+
*
|
|
25
|
+
* Created by {@link DidBtcr2.resolve} (the factory). The caller drives resolution
|
|
26
|
+
* by repeatedly calling {@link resolve} and {@link provide}:
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const resolver = DidBtcr2.resolve(did, { sidecar });
|
|
30
|
+
* let state = resolver.resolve();
|
|
31
|
+
*
|
|
32
|
+
* while (state.status === 'action-required') {
|
|
33
|
+
* for (const need of state.needs) { ... fetch & provide ... }
|
|
34
|
+
* state = resolver.resolve();
|
|
35
|
+
* }
|
|
36
|
+
* const { didDocument, metadata } = state.result;
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* The Resolver performs **zero I/O**. All external data (Bitcoin signals, CAS
|
|
40
|
+
* data, genesis documents) flows through the advance/provide protocol.
|
|
41
|
+
*
|
|
42
|
+
* @class Resolver
|
|
43
|
+
*/
|
|
44
|
+
export class Resolver {
|
|
45
|
+
// --- Immutable inputs ---
|
|
46
|
+
#didComponents;
|
|
47
|
+
#versionId;
|
|
48
|
+
#versionTime;
|
|
49
|
+
/**
|
|
50
|
+
* The specific phase the Resolver is current in.
|
|
51
|
+
*/
|
|
52
|
+
#phase;
|
|
53
|
+
#sidecarData;
|
|
54
|
+
#currentDocument;
|
|
55
|
+
#providedGenesisDocument = null;
|
|
56
|
+
#beaconServicesSignals = new Map();
|
|
57
|
+
#processedServices = new Set();
|
|
58
|
+
#requestCache = new Set();
|
|
59
|
+
#unsortedUpdates = [];
|
|
60
|
+
#resolvedResponse = null;
|
|
61
|
+
/**
|
|
62
|
+
* @internal — Use {@link DidBtcr2.resolve} to create instances.
|
|
63
|
+
*/
|
|
64
|
+
constructor(didComponents, sidecarData, currentDocument, options) {
|
|
65
|
+
this.#didComponents = didComponents;
|
|
66
|
+
this.#sidecarData = sidecarData;
|
|
67
|
+
this.#currentDocument = currentDocument;
|
|
68
|
+
this.#versionId = options?.versionId;
|
|
69
|
+
this.#versionTime = options?.versionTime;
|
|
70
|
+
// If a genesis document was provided (from sidecar), pre-seed it for validation
|
|
71
|
+
if (options?.genesisDocument) {
|
|
72
|
+
this.#providedGenesisDocument = options.genesisDocument;
|
|
73
|
+
}
|
|
74
|
+
// If current document was established by the factory, skip GenesisDocument phase
|
|
75
|
+
this.#phase = currentDocument
|
|
76
|
+
? ResolverPhase.BeaconDiscovery
|
|
77
|
+
: ResolverPhase.GenesisDocument;
|
|
78
|
+
}
|
|
23
79
|
/**
|
|
24
80
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#if-genesis_bytes-is-a-secp256k1-public-key | 7.2.d.1 if genesis bytes is a secp256k1 Public Key}.
|
|
25
81
|
* @param {DidComponents} didComponents The decoded components of the did.
|
|
@@ -27,11 +83,11 @@ export class Resolve {
|
|
|
27
83
|
*/
|
|
28
84
|
static deterministic(didComponents) {
|
|
29
85
|
// Deconstruct the bytes from the given components
|
|
30
|
-
const
|
|
86
|
+
const genesisBytes = didComponents.genesisBytes;
|
|
31
87
|
// Encode the did from the didComponents
|
|
32
88
|
const did = Identifier.encode(genesisBytes, didComponents);
|
|
33
89
|
// Construct a new CompressedSecp256k1PublicKey and deconstruct the publicKey and publicKeyMultibase
|
|
34
|
-
const { multibase
|
|
90
|
+
const { multibase } = new CompressedSecp256k1PublicKey(genesisBytes);
|
|
35
91
|
// Generate the service field for the DID Document
|
|
36
92
|
const service = BeaconUtils.generateBeaconServices({
|
|
37
93
|
id: did,
|
|
@@ -45,7 +101,7 @@ export class Resolve {
|
|
|
45
101
|
id: `${did}#initialKey`,
|
|
46
102
|
type: 'Multikey',
|
|
47
103
|
controller: did,
|
|
48
|
-
publicKeyMultibase:
|
|
104
|
+
publicKeyMultibase: multibase.encoded
|
|
49
105
|
}],
|
|
50
106
|
service
|
|
51
107
|
});
|
|
@@ -53,23 +109,21 @@ export class Resolve {
|
|
|
53
109
|
/**
|
|
54
110
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#if-genesis_bytes-is-a-sha-256-hash | 7.2.d.2 if genesis_bytes is a SHA-256 Hash}.
|
|
55
111
|
* @param {DidComponents} didComponents BTCR2 DID components used to resolve the DID Document
|
|
56
|
-
* @param {
|
|
57
|
-
* @returns {
|
|
112
|
+
* @param {object} genesisDocument The genesis document for resolving the DID Document.
|
|
113
|
+
* @returns {DidDocument} The resolved DID Document object
|
|
58
114
|
* @throws {ResolveError} InvalidDidDocument if not conformant to DID Core v1.1
|
|
59
115
|
*/
|
|
60
|
-
static
|
|
61
|
-
//
|
|
62
|
-
const
|
|
63
|
-
// Convert the genesis bytes to a hex string
|
|
64
|
-
const genesisHex = hex.encode(genesisBytes);
|
|
116
|
+
static external(didComponents, genesisDocument) {
|
|
117
|
+
// Encode the genesis bytes from the did components
|
|
118
|
+
const genesisBytes = encodeHash(didComponents.genesisBytes);
|
|
65
119
|
// Canonicalize and sha256 hash the currentDocument
|
|
66
|
-
const
|
|
120
|
+
const genesisDocumentBytes = canonicalHash(genesisDocument);
|
|
67
121
|
// If the genesisBytes do not match the hashBytes, throw an error
|
|
68
|
-
if (
|
|
69
|
-
throw new ResolveError(`Initial document mismatch: genesisBytes
|
|
122
|
+
if (genesisBytes !== genesisDocumentBytes) {
|
|
123
|
+
throw new ResolveError(`Initial document mismatch: genesisBytes !== genesisDocumentBytes`, INVALID_DID_DOCUMENT, { genesisBytes, genesisDocumentBytes });
|
|
70
124
|
}
|
|
71
125
|
// Encode the did from the didComponents
|
|
72
|
-
const did = Identifier.encode(genesisBytes, didComponents);
|
|
126
|
+
const did = Identifier.encode(decodeHash(genesisBytes), didComponents);
|
|
73
127
|
// Replace the placeholder did with the did throughout the currentDocument.
|
|
74
128
|
const currentDocument = JSON.parse(JSON.stringify(genesisDocument).replaceAll(ID_PLACEHOLDER_VALUE, did));
|
|
75
129
|
// Return a W3C conformant DID Document
|
|
@@ -78,20 +132,20 @@ export class Resolve {
|
|
|
78
132
|
/**
|
|
79
133
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-sidecar-data | Process Sidecar Data}
|
|
80
134
|
* @param {Sidecar} sidecar The sidecar data to process.
|
|
81
|
-
* @returns {
|
|
135
|
+
* @returns {SidecarData} The processed sidecar data containing maps of updates, CAS announcements, and SMT proofs.
|
|
82
136
|
*/
|
|
83
137
|
static sidecarData(sidecar = {}) {
|
|
84
138
|
// BTCR2 Signed Updates map
|
|
85
139
|
const updateMap = new Map();
|
|
86
140
|
if (sidecar.updates?.length)
|
|
87
141
|
for (const update of sidecar.updates) {
|
|
88
|
-
updateMap.set(canonicalHash(update
|
|
142
|
+
updateMap.set(canonicalHash(update), update);
|
|
89
143
|
}
|
|
90
144
|
// CAS Announcements map
|
|
91
145
|
const casMap = new Map();
|
|
92
146
|
if (sidecar.casUpdates?.length)
|
|
93
147
|
for (const update of sidecar.casUpdates) {
|
|
94
|
-
casMap.set(canonicalHash(update
|
|
148
|
+
casMap.set(canonicalHash(update), update);
|
|
95
149
|
}
|
|
96
150
|
// SMT Proofs map
|
|
97
151
|
const smtMap = new Map();
|
|
@@ -101,68 +155,15 @@ export class Resolve {
|
|
|
101
155
|
}
|
|
102
156
|
return { updateMap, casMap, smtMap };
|
|
103
157
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#establish-current-document | 7.2.d Establish current_document}.
|
|
106
|
-
* Resolution begins by creating an Initial Did Document called current_document (Current DID Document).
|
|
107
|
-
* The current_document is iteratively patched with BTCR2 Signed Updates announced by Authorized Beacon Signals.
|
|
108
|
-
* @param {DidComponents} didComponents The decoded components of the did.
|
|
109
|
-
* @param {GenesisDocument} genesisDocument The genesis document for resolving the DID Document.
|
|
110
|
-
* @returns {Promise<DidDocument>} The resolved DID Document object.
|
|
111
|
-
* @throws {ResolveError} if the DID hrp is invalid, no sidecarData passed and hrp = "x".
|
|
112
|
-
*/
|
|
113
|
-
static async currentDocument(didComponents, genesisDocument) {
|
|
114
|
-
// Deconstruct the hrp from the components
|
|
115
|
-
const { hrp, genesisBytes } = didComponents;
|
|
116
|
-
// If hrp `x`, perform external resolution
|
|
117
|
-
if (hrp === IdentifierHrp.x) {
|
|
118
|
-
if (!genesisDocument)
|
|
119
|
-
throw new ResolveError('External resolution requires genesisDocument', MISSING_UPDATE_DATA, { didComponents });
|
|
120
|
-
return await this.external(didComponents, genesisDocument);
|
|
121
|
-
}
|
|
122
|
-
// Check for hrp `k`
|
|
123
|
-
if (hrp === IdentifierHrp.k) {
|
|
124
|
-
// Validate genesis bytes as a compressed secp256k1 public key
|
|
125
|
-
if (!CompressedSecp256k1PublicKey.isValid(genesisBytes)) {
|
|
126
|
-
throw new ResolveError('Deterministic resolution requires valid secp256k1 public key', INVALID_DID, { genesisBytes });
|
|
127
|
-
}
|
|
128
|
-
// Perform deterministic resolution
|
|
129
|
-
return this.deterministic(didComponents);
|
|
130
|
-
}
|
|
131
|
-
// Else, throw an error for unsupported hrp
|
|
132
|
-
throw new ResolveError(`Unsupported DID hrp ${hrp}`, INVALID_DID, { hrp });
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Finds uses the beacon services in the currentDocument to scan for onchain Beacon Signals (transactions) containing
|
|
136
|
-
* Signal Bytes (last output in OP_RETURN transaction).
|
|
137
|
-
* @param {Array<BeaconService>} beaconServices The array of BeaconService objects to search for signals.
|
|
138
|
-
* @param {SidecarData} sidecarData The sidecar data containing maps of updates, CAS announcements, and SMT proofs.
|
|
139
|
-
* @param {BitcoinConnection} bitcoin The bitcoin network connection used to fetch beacon signals
|
|
140
|
-
* @returns {Promise<Array<[SignedBTCR2Update, BlockMetadata]>>} The array of BTCR2 Signed Updates announced by the Beacon Signals.
|
|
141
|
-
*/
|
|
142
|
-
static async beaconSignals(beaconServices, sidecarData, bitcoin) {
|
|
143
|
-
// Discover Beacon Signals via indexer server (esplora/electrs) or full node
|
|
144
|
-
const beaconServicesSignals = bitcoin.rest
|
|
145
|
-
? await BeaconSignalDiscovery.indexer(beaconServices, bitcoin)
|
|
146
|
-
: await BeaconSignalDiscovery.fullnode(beaconServices, bitcoin);
|
|
147
|
-
// Process each beacon's signals in parallel
|
|
148
|
-
const promises = await Promise.all(Array.from(beaconServicesSignals.entries()).map(async ([service, signals]) => {
|
|
149
|
-
// Skip beacons with no signals
|
|
150
|
-
if (!signals.length)
|
|
151
|
-
return [];
|
|
152
|
-
// Establish a typed beacon and process its signals
|
|
153
|
-
return BeaconFactory.establish(service).processSignals(signals, sidecarData);
|
|
154
|
-
}));
|
|
155
|
-
return promises.flat();
|
|
156
|
-
}
|
|
157
158
|
/**
|
|
158
159
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-updates | 7.2.f Process updates Array}.
|
|
159
160
|
* @param {DidDocument} currentDocument The current DID Document to apply the updates to.
|
|
160
161
|
* @param {Array<[SignedBTCR2Update, BlockMetadata]>} unsortedUpdates The unsorted array of BTCR2 Signed Updates and their associated Block Metadata.
|
|
161
162
|
* @param {string} [versionTime] The optional version time to limit updates to.
|
|
162
163
|
* @param {string} [versionId] The optional version id to limit updates to.
|
|
163
|
-
* @returns {
|
|
164
|
+
* @returns {DidResolutionResponse} The updated DID Document, number of confirmations, and version id.
|
|
164
165
|
*/
|
|
165
|
-
static
|
|
166
|
+
static updates(currentDocument, unsortedUpdates, versionTime, versionId) {
|
|
166
167
|
// Start the version number being processed at 1
|
|
167
168
|
let currentVersionId = 1;
|
|
168
169
|
// Initialize an empty array to hold the update hashes
|
|
@@ -182,7 +183,7 @@ export class Resolve {
|
|
|
182
183
|
// Iterate over each (update block) pair
|
|
183
184
|
for (const [update, block] of updates) {
|
|
184
185
|
// Get the hash of the current document
|
|
185
|
-
const currentDocumentHash = canonicalHash(response.didDocument
|
|
186
|
+
const currentDocumentHash = canonicalHash(response.didDocument);
|
|
186
187
|
// Safely convert block.time to timestamp
|
|
187
188
|
const blocktime = DateUtils.blocktimeToTimestamp(block.time);
|
|
188
189
|
// TODO: How to detect if block is unconfirmed and exit gracefully or return without it
|
|
@@ -211,11 +212,11 @@ export class Resolve {
|
|
|
211
212
|
throw new ResolveError(`Hash mismatch: update.sourceHash !== currentDocumentHash`, INVALID_DID_UPDATE, { sourceHash: update.sourceHash, currentDocumentHash });
|
|
212
213
|
}
|
|
213
214
|
// Apply the update to the currentDocument and set it in the response
|
|
214
|
-
response.didDocument =
|
|
215
|
+
response.didDocument = this.applyUpdate(response.didDocument, update);
|
|
215
216
|
// Create unsigned_update by removing the proof property from update.
|
|
216
217
|
const unsignedUpdate = JSONUtils.deleteKeys(update, ['proof']);
|
|
217
218
|
// Push the canonicalized unsigned update hash to the updateHashHistory
|
|
218
|
-
updateHashHistory.push(canonicalHash(unsignedUpdate
|
|
219
|
+
updateHashHistory.push(canonicalHash(unsignedUpdate));
|
|
219
220
|
}
|
|
220
221
|
// If update.targetVersionId > currentVersionId + 1, throw LATE_PUBLISHING error
|
|
221
222
|
else if (update.targetVersionId > currentVersionId + 1) {
|
|
@@ -229,13 +230,14 @@ export class Resolve {
|
|
|
229
230
|
// Set response.versionId to be the new currentVersionId
|
|
230
231
|
response.metadata.versionId = `${currentVersionId}`;
|
|
231
232
|
// If resolutionOptions.versionId is defined and <= currentVersionId, return currentDocument
|
|
232
|
-
|
|
233
|
+
const versionIdNumber = Number(versionId);
|
|
234
|
+
if (!isNaN(versionIdNumber) && versionIdNumber <= currentVersionId) {
|
|
233
235
|
return response;
|
|
234
236
|
}
|
|
235
237
|
// Check if the current document is deactivated before further processing
|
|
236
|
-
if (
|
|
238
|
+
if (response.didDocument.deactivated) {
|
|
237
239
|
// Set the response deactivated flag to true
|
|
238
|
-
response.metadata.deactivated =
|
|
240
|
+
response.metadata.deactivated = response.didDocument.deactivated;
|
|
239
241
|
// If deactivated, stop processing further updates and return the response
|
|
240
242
|
return response;
|
|
241
243
|
}
|
|
@@ -243,10 +245,12 @@ export class Resolve {
|
|
|
243
245
|
// Return response data
|
|
244
246
|
return response;
|
|
245
247
|
}
|
|
248
|
+
// ─── Private static: update internals ──────────────────────────────
|
|
246
249
|
/**
|
|
247
250
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/#confirm-duplicate-update | 7.2.f.1 Confirm Duplicate Update}.
|
|
248
251
|
* This step confirms that an update with a lower-than-expected targetVersionId is a true duplicate.
|
|
249
252
|
* @param {SignedBTCR2Update} update The BTCR2 Signed Update to confirm as a duplicate.
|
|
253
|
+
* @param {string[]} updateHashHistory The accumulated hash history for comparison.
|
|
250
254
|
* @returns {void} Does not return a value, but throws an error if the update is not a valid duplicate.
|
|
251
255
|
*/
|
|
252
256
|
static confirmDuplicate(update, updateHashHistory) {
|
|
@@ -265,10 +269,10 @@ export class Resolve {
|
|
|
265
269
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#apply-update | 7.2.f.3 Apply Update}.
|
|
266
270
|
* @param {DidDocument} currentDocument The current DID Document to apply the update to.
|
|
267
271
|
* @param {SignedBTCR2Update} update The BTCR2 Signed Update to apply.
|
|
268
|
-
* @returns {
|
|
272
|
+
* @returns {DidDocument} The updated DID Document after applying the update.
|
|
269
273
|
* @throws {ResolveError} If the update is invalid or cannot be applied.
|
|
270
274
|
*/
|
|
271
|
-
static
|
|
275
|
+
static applyUpdate(currentDocument, update) {
|
|
272
276
|
// Get the capability id from the to update proof.
|
|
273
277
|
const capabilityId = update.proof?.capability;
|
|
274
278
|
// Since this field is optional, check that it exists
|
|
@@ -313,7 +317,7 @@ export class Resolve {
|
|
|
313
317
|
// Verify that updatedDocument is conformant to DID Core v1.1.
|
|
314
318
|
DidDocument.validate(updatedDocument);
|
|
315
319
|
// Canonicalize and hash the updatedDocument to get the currentDocumentHash.
|
|
316
|
-
const currentDocumentHash = canonicalHash(updatedDocument
|
|
320
|
+
const currentDocumentHash = canonicalHash(updatedDocument);
|
|
317
321
|
// Prepare the update targetHash for comparison with currentDocumentHash.
|
|
318
322
|
const updateTargetHash = update.targetHash;
|
|
319
323
|
// Make sure the update.targetHash equals currentDocumentHash.
|
|
@@ -324,5 +328,149 @@ export class Resolve {
|
|
|
324
328
|
// Return final updatedDocument.
|
|
325
329
|
return updatedDocument;
|
|
326
330
|
}
|
|
331
|
+
// ─── Instance: state machine ───────────────────────────────────────
|
|
332
|
+
/**
|
|
333
|
+
* Advance the state machine. Returns either:
|
|
334
|
+
* - `{ status: 'action-required', needs }` — caller must provide data via {@link provide}
|
|
335
|
+
* - `{ status: 'resolved', result }` — resolution complete
|
|
336
|
+
*
|
|
337
|
+
* Analogous to Rust's `Resolver::resolve()`.
|
|
338
|
+
*/
|
|
339
|
+
resolve() {
|
|
340
|
+
// Internal loop — keeps advancing through phases until data is needed or done
|
|
341
|
+
while (true) {
|
|
342
|
+
switch (this.#phase) {
|
|
343
|
+
// Phase: GenesisDocument
|
|
344
|
+
// Only entered for EXTERNAL (x HRP) identifiers when genesis doc was not in sidecar.
|
|
345
|
+
case ResolverPhase.GenesisDocument: {
|
|
346
|
+
if (this.#providedGenesisDocument) {
|
|
347
|
+
// Genesis doc was provided — establish the current document
|
|
348
|
+
this.#currentDocument = Resolver.external(this.#didComponents, this.#providedGenesisDocument);
|
|
349
|
+
this.#providedGenesisDocument = null;
|
|
350
|
+
this.#phase = ResolverPhase.BeaconDiscovery;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
// Need genesis document from caller
|
|
354
|
+
const genesisHash = encodeHash(this.#didComponents.genesisBytes);
|
|
355
|
+
return {
|
|
356
|
+
status: 'action-required',
|
|
357
|
+
needs: [{ kind: 'NeedGenesisDocument', genesisHash }]
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
// Phase: BeaconDiscovery
|
|
361
|
+
// Extract beacon services, emit NeedBeaconSignals for addresses not yet queried.
|
|
362
|
+
case ResolverPhase.BeaconDiscovery: {
|
|
363
|
+
const beaconServices = BeaconUtils.getBeaconServices(this.#currentDocument);
|
|
364
|
+
// Filter to services whose addresses haven't been requested yet
|
|
365
|
+
const newServices = beaconServices.filter(service => {
|
|
366
|
+
const address = BeaconUtils.parseBitcoinAddress(service.serviceEndpoint);
|
|
367
|
+
return !this.#requestCache.has(address);
|
|
368
|
+
});
|
|
369
|
+
if (newServices.length > 0) {
|
|
370
|
+
// Mark addresses as requested so we don't re-request on subsequent rounds
|
|
371
|
+
for (const service of newServices) {
|
|
372
|
+
const address = BeaconUtils.parseBitcoinAddress(service.serviceEndpoint);
|
|
373
|
+
this.#requestCache.add(address);
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
status: 'action-required',
|
|
377
|
+
needs: [{ kind: 'NeedBeaconSignals', beaconServices: newServices }]
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
// No new beacon services to query — move to processing
|
|
381
|
+
this.#phase = ResolverPhase.BeaconProcess;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
// Phase: BeaconProcess
|
|
385
|
+
// Process each beacon's signals. Collect updates and data needs.
|
|
386
|
+
case ResolverPhase.BeaconProcess: {
|
|
387
|
+
const allNeeds = [];
|
|
388
|
+
for (const [service, signals] of this.#beaconServicesSignals) {
|
|
389
|
+
// Skip already-processed services and services with no signals
|
|
390
|
+
if (this.#processedServices.has(service.id) || !signals.length)
|
|
391
|
+
continue;
|
|
392
|
+
// Establish a typed beacon and process its signals
|
|
393
|
+
const beacon = BeaconFactory.establish(service);
|
|
394
|
+
const result = beacon.processSignals(signals, this.#sidecarData);
|
|
395
|
+
if (result.needs.length > 0) {
|
|
396
|
+
// This service has unmet data needs — collect them
|
|
397
|
+
allNeeds.push(...result.needs);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
// All signals for this service resolved — collect updates, mark processed
|
|
401
|
+
this.#unsortedUpdates.push(...result.updates);
|
|
402
|
+
this.#processedServices.add(service.id);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (allNeeds.length > 0) {
|
|
406
|
+
return { status: 'action-required', needs: allNeeds };
|
|
407
|
+
}
|
|
408
|
+
this.#phase = ResolverPhase.ApplyUpdates;
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
// Phase: ApplyUpdates
|
|
412
|
+
// Apply collected updates, then check for new beacon services (multi-round).
|
|
413
|
+
case ResolverPhase.ApplyUpdates: {
|
|
414
|
+
if (this.#unsortedUpdates.length > 0) {
|
|
415
|
+
// Apply all collected updates to the current document
|
|
416
|
+
this.#resolvedResponse = Resolver.updates(this.#currentDocument, this.#unsortedUpdates, this.#versionTime, this.#versionId);
|
|
417
|
+
this.#currentDocument = this.#resolvedResponse.didDocument;
|
|
418
|
+
this.#unsortedUpdates = [];
|
|
419
|
+
// Check for new beacon services added by updates (multi-round discovery)
|
|
420
|
+
const beaconServices = BeaconUtils.getBeaconServices(this.#currentDocument);
|
|
421
|
+
const hasNewServices = beaconServices.some(service => {
|
|
422
|
+
const address = BeaconUtils.parseBitcoinAddress(service.serviceEndpoint);
|
|
423
|
+
return !this.#requestCache.has(address);
|
|
424
|
+
});
|
|
425
|
+
if (hasNewServices) {
|
|
426
|
+
// Loop back to discover signals for new beacon services
|
|
427
|
+
this.#phase = ResolverPhase.BeaconDiscovery;
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
this.#phase = ResolverPhase.Complete;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
// Phase: Complete
|
|
435
|
+
case ResolverPhase.Complete: {
|
|
436
|
+
return {
|
|
437
|
+
status: 'resolved',
|
|
438
|
+
result: this.#resolvedResponse ?? {
|
|
439
|
+
didDocument: this.#currentDocument,
|
|
440
|
+
metadata: {
|
|
441
|
+
versionId: this.#versionId ?? '1',
|
|
442
|
+
deactivated: this.#currentDocument.deactivated || false
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
provide(need, data) {
|
|
451
|
+
switch (need.kind) {
|
|
452
|
+
case 'NeedGenesisDocument': {
|
|
453
|
+
this.#providedGenesisDocument = data;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
case 'NeedBeaconSignals': {
|
|
457
|
+
const signals = data;
|
|
458
|
+
for (const [service, serviceSignals] of signals) {
|
|
459
|
+
this.#beaconServicesSignals.set(service, serviceSignals);
|
|
460
|
+
}
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
case 'NeedCASAnnouncement': {
|
|
464
|
+
const announcement = data;
|
|
465
|
+
this.#sidecarData.casMap.set(canonicalHash(announcement), announcement);
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
case 'NeedSignedUpdate': {
|
|
469
|
+
const update = data;
|
|
470
|
+
this.#sidecarData.updateMap.set(canonicalHash(update), update);
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
327
475
|
}
|
|
328
|
-
//# sourceMappingURL=
|
|
476
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,aAAa,EACb,YAAY,EACZ,SAAS,EACT,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,EAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAi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,KAAK,kBAAkB,CAAC,CAAC,CAAC;gBACxB,MAAM,MAAM,GAAG,IAAyB,CAAC;gBACzC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;gBAC/D,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/esm/core/update.js
CHANGED
|
@@ -22,10 +22,10 @@ export class Update {
|
|
|
22
22
|
* @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
|
|
23
23
|
* @param {PatchOperation[]} patches The array of JSON Patch operations to apply to the sourceDocument.
|
|
24
24
|
* @param {number} sourceVersionId The version ID of the source document.
|
|
25
|
-
* @returns {
|
|
25
|
+
* @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
|
|
26
26
|
* @throws {UpdateError} InvalidDid if sourceDocument.id does not match identifier.
|
|
27
27
|
*/
|
|
28
|
-
static
|
|
28
|
+
static construct(sourceDocument, patches, sourceVersionId) {
|
|
29
29
|
// Initialize an unsigned update conformant to btcr2 spec.
|
|
30
30
|
const unsignedUpdate = {
|
|
31
31
|
'@context': [
|
|
@@ -37,7 +37,7 @@ export class Update {
|
|
|
37
37
|
patch: patches,
|
|
38
38
|
targetHash: '',
|
|
39
39
|
targetVersionId: sourceVersionId + 1,
|
|
40
|
-
sourceHash: canonicalHash(sourceDocument
|
|
40
|
+
sourceHash: canonicalHash(sourceDocument),
|
|
41
41
|
};
|
|
42
42
|
// Apply all JSON patches to sourceDocument.
|
|
43
43
|
const targetDocument = JSONPatch.apply(sourceDocument, patches);
|
|
@@ -50,7 +50,7 @@ export class Update {
|
|
|
50
50
|
throw new UpdateError('Error validating targetDocument: ' + (error instanceof Error ? error.message : String(error)), INVALID_DID_UPDATE, targetDocument);
|
|
51
51
|
}
|
|
52
52
|
// Set the targetHash by canonicalizing the targetDocument and encoding it in base64url.
|
|
53
|
-
unsignedUpdate.targetHash = canonicalHash(targetDocument
|
|
53
|
+
unsignedUpdate.targetHash = canonicalHash(targetDocument);
|
|
54
54
|
// Return unsignedUpdate.
|
|
55
55
|
return unsignedUpdate;
|
|
56
56
|
}
|
|
@@ -64,7 +64,7 @@ export class Update {
|
|
|
64
64
|
* @returns {SignedBTCR2Update} Did update payload secured with a proof => SignedBTCR2Update
|
|
65
65
|
* @throws {UpdateError} if the privateKeyBytes are invalid
|
|
66
66
|
*/
|
|
67
|
-
static
|
|
67
|
+
static sign(did, unsignedUpdate, verificationMethod, secretKey) {
|
|
68
68
|
// Parse the controller from the verificationMethod
|
|
69
69
|
const controller = verificationMethod.controller;
|
|
70
70
|
// Parse the fragment from the vmId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,SAAS,EAGT,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,eAAe,EAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAoB,WAAW,EAAyB,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,MAAM;IACjB;;;;;;;;;OASG;IACH,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/core/update.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,SAAS,EAGT,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,eAAe,EAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAoB,WAAW,EAAyB,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,MAAM;IACjB;;;;;;;;;OASG;IACH,M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