Constructs a new DidResolver
.
The parameters for constructing the DidResolver
.
Protected
cacheA cache for storing resolved DID documents.
Private
didA map to store method resolvers against method names.
Dereferences a DID (Decentralized Identifier) URL to a corresponding DID resource.
This method interprets the DID URL's components, which include the DID method, method-specific identifier, path, query, and fragment, and retrieves the related resource as per the DID Core specifications.
The dereferencing process involves resolving the DID contained in the DID URL to a DID document, and then extracting the specific part of the document identified by the fragment in the DID URL. If no fragment is specified, the entire DID document is returned.
This method supports resolution of different components within a DID document such as service endpoints and verification methods, based on their IDs. It accommodates both full and DID URLs as specified in the DID Core specification.
More information on DID URL dereferencing can be found in the DID Core specification.
TODO: This is a partial implementation and does not fully implement DID URL dereferencing. (https://github.com/TBD54566975/web5-js/issues/387)
The DID URL string to dereference.
Optional
_options: DidDereferencingOptionsInput options to the dereference function. Optional.
Resolves a DID to a DID Resolution Result.
If the DID Resolution Result is present in the cache, it returns the cached result. Otherwise, it uses the appropriate method resolver to resolve the DID, stores the resolution result in the cache, and returns the resolultion result.
The DID or DID URL to resolve.
Optional
options: DidResolutionOptionsA promise that resolves to the DID Resolution Result.
The
DidResolver
class provides mechanisms for resolving Decentralized Identifiers (DIDs) to their corresponding DID documents.The class is designed to handle various DID methods by utilizing an array of
DidMethodResolver
instances, each responsible for a specific DID method.Providing a cache implementation can significantly enhance resolution performance by avoiding redundant resolutions for previously resolved DIDs. If omitted, a no-operation cache is used, which effectively disables caching.
Usage:
DidResolver
with an array ofDidMethodResolver
instances and an optional cache.resolve
to resolve a DID to its DID Resolution Result.dereference
to extract specific resources from a DID URL, like service endpoints or verification methods.Example