The @zcloak/did-resolver
module is designed to resolve the DID (Decentralized Identifiers) syntax-like string and fetch the DID Document from the registry. The registry could be a database (test environment) or a blockchain (Arweave). Each resolver should extend the DidResolver class and implement the resolve method that accepts a DID and returns the DidDocument.
yarn add @zcloak/did-resolver
import { ArweaveDidResolver } from '@zcloak/did-resolver';
...
DidResolver
ClassThe DidResolver
class is an abstract class that provides the base for all DID resolvers.
export abstract class DidResolver {
public parseDid(did: string): ParsedDid {
//......
}
public resolve(didUrl: string): Promise<DidDocument> {
//......
}
}
Key methods include:
parseDid(params)
public parseDid(did: string): ParsedDid {
//......
}
ParsedDid
object.did
- The DID string that needs to be parsed.ParsedDid
object - A ParsedDid
object which represents the parsed DID.resolve(params)
public resolve(didUrl: string): Promise<DidDocument> {
//......
}
DidDocument
.didUrl
- The DID URL that needs to be resolved