Decentralized Identifiers, or DIDs, constitute a novel identifier class designed to facilitate verifiable, decentralized digital identities. Within the zCloak's SDK, the @zcloak/did
module delivers an arsenal of tools designed for creating, managing, and resolving DIDs.
yarn add @zcloak/did
import { helpers } from '@zcloak/did';
import { keys } from '@zcloak/did';
...
DidDetails
ClassThe DidDetails
class, implementing the IDidDetails
interface, represents the DID Document. It provides a collection of methods designed for handling the DID Document.
export abstract class DidDetails implements IDidDetails {
public id: DidUrl;
public identifier: string;
public controller: Set<DidUrl>;
public keyRelationship: Map<DidUrl, KeyRelationship>;
public authentication?: Set<DidUrl>;
public assertionMethod?: Set<DidUrl>;
public keyAgreement?: Set<DidUrl>;
public capabilityInvocation?: Set<DidUrl>;
public capabilityDelegation?: Set<DidUrl>;
public service?: Map<string, Service>;
//...
}
Key methods include:
getKeyUrl(params)
public getKeyUrl(key: DidKeys): DidUrl {
// ......
}
key
- The DID keys from the DID document.DidUrl
- The first DID URL associated with the provided DID keys.get(params)
public get(id: DidUrl): KeyRelationship {
// ......
}
id
- The specific DID URL.