Class: Resolve ​
Defined in: packages/method/src/core/resolve.ts:60
Implements 7.2 Resolve. Resolving a did:btcr2 identifier iteratively builds a DID document by applying BTCR2 Updates to an Initial DID Document that have been committed to the Bitcoin blockchain by Authorized Beacon Signals. The Initial DID Document is either deterministically created from the DID or provided by Sidecar Data. Resolve
Constructors ​
Constructor ​
new Resolve():
Resolve
Returns ​
Resolve
Methods ​
applyDidUpdate() ​
staticapplyDidUpdate(currentDocument,update):Promise<DidDocument>
Defined in: packages/method/src/core/resolve.ts:618
Implements subsection 7.2.f.3 Apply Update.
Parameters ​
currentDocument ​
The current DID Document to apply the update to.
update ​
The BTCR2 Signed Update to apply.
Returns ​
Promise<DidDocument>
The updated DID Document after applying the update.
Throws ​
If the update is invalid or cannot be applied.
confirmDuplicateUpdate() ​
staticconfirmDuplicateUpdate(update,updateHashHistory):void
Defined in: packages/method/src/core/resolve.ts:592
Implements subsection 7.2.f.1 Confirm Duplicate Update. This step confirms that an update with a lower-than-expected targetVersionId is a true duplicate.
Parameters ​
update ​
The BTCR2 Signed Update to confirm as a duplicate.
updateHashHistory ​
string[]
Returns ​
void
Does not return a value, but throws an error if the update is not a valid duplicate.
deterministic() ​
staticdeterministic(didComponents):DidDocument
Defined in: packages/method/src/core/resolve.ts:139
Implements subsection 7.2.d.1 if genesis bytes is a secp256k1 Public Key.
Parameters ​
didComponents ​
The decoded components of the did.
Returns ​
The resolved DID Document object.
establishCurrentDocument() ​
staticestablishCurrentDocument(didComponents,genesisDocument?):Promise<DidDocument>
Defined in: packages/method/src/core/resolve.ts:100
Implements subsection 7.2.d Establish current_document. Resolution begins by creating an Initial Did Document called current_document (Current DID Document). The current_document is iteratively patched with BTCR2 Signed Updates announced by Authorized Beacon Signals.
Parameters ​
didComponents ​
The decoded components of the did.
genesisDocument? ​
object
The genesis document for resolving the DID Document.
Returns ​
Promise<DidDocument>
The resolved DID Document object.
Throws ​
if the DID hrp is invalid, no sidecarData passed and hrp = "x".
external() ​
staticexternal(didComponents,genesisDocument):Promise<DidDocument>
Defined in: packages/method/src/core/resolve.ts:177
Implements subsection 7.2.d.2 if genesis_bytes is a SHA-256 Hash.
Parameters ​
didComponents ​
BTCR2 DID components used to resolve the DID Document
genesisDocument ​
object
The genesis document for resolving the DID Document.
Returns ​
Promise<DidDocument>
The resolved DID Document object
Throws ​
InvalidDidDocument if not conformant to DID Core v1.1
processBeaconSignals() ​
staticprocessBeaconSignals(beaconServices,sidecarData,bitcoin,fullBlockchainTraversal?):Promise<[BTCR2SignedUpdate,BlockMetadata][]>
Defined in: packages/method/src/core/resolve.ts:216
Finds uses the beacon services in the currentDocument to scan for onchain Beacon Signals (transactions) containing Signal Bytes (last output in OP_RETURN transaction).
Parameters ​
beaconServices ​
The array of BeaconService objects to search for signals.
sidecarData ​
The sidecar data containing maps of updates, CAS announcements, and SMT proofs.
bitcoin ​
The bitcoin network connection used to fetch beacon signals
fullBlockchainTraversal? ​
boolean
Whether to perform a full blockchain traversal or use an indexer
Returns ​
Promise<[BTCR2SignedUpdate, BlockMetadata][]>
The array of BTCR2 Signed Updates announced by the Beacon Signals.
processSidecarData() ​
staticprocessSidecarData(sidecar?):SidecarData
Defined in: packages/method/src/core/resolve.ts:66
Implements subsection Process Sidecar Data
Parameters ​
sidecar? ​
Sidecar = ...
The sidecar data to process.
Returns ​
The processed sidecar data containing maps of updates, CAS announcements, and SMT proofs.
processUpdatesArray() ​
staticprocessUpdatesArray(currentDocument,unsortedUpdates,versionTime?,versionId?):Promise<DidResolutionResponse>
Defined in: packages/method/src/core/resolve.ts:252
Implements subsection 7.2.f Process updates Array.
Parameters ​
currentDocument ​
The current DID Document to apply the updates to.
unsortedUpdates ​
[BTCR2SignedUpdate, BlockMetadata][]
The unsorted array of BTCR2 Signed Updates and their associated Block Metadata.
versionTime? ​
string
The optional version time to limit updates to.
versionId? ​
string
The optional version id to limit updates to.
Returns ​
Promise<DidResolutionResponse>
The updated DID Document, number of confirmations, and version id.
queryBlockchainIndexer() ​
staticqueryBlockchainIndexer(beaconServices,bitcoin):Promise<Map<BeaconService,BeaconSignal[]>>
Defined in: packages/method/src/core/resolve.ts:363
Retrieves the beacon signals for the given array of BeaconService objects using a esplora/electrs REST API connection via a bitcoin I/O driver.
Parameters ​
beaconServices ​
Array of BeaconService objects to retrieve signals for
bitcoin ​
Bitcoin network connection to use for REST calls
Returns ​
Promise<Map<BeaconService, BeaconSignal[]>>
Promise resolving to an array of BeaconSignal objects
traverseFullBlockchain() ​
statictraverseFullBlockchain(beaconServices,bitcoin):Promise<Map<BeaconService,BeaconSignal[]>>
Defined in: packages/method/src/core/resolve.ts:445
Traverse the full blockchain from genesis to chain top looking for beacon signals.
Parameters ​
beaconServices ​
Array of BeaconService objects to search for signals.
bitcoin ​
Bitcoin network connection to use for RPC calls.
Returns ​
Promise<Map<BeaconService, BeaconSignal[]>>
Promise resolving to an array of BeaconSignal objects.