UNPKG

@enbox/api

Version:

SDK for accessing the features and capabilities of Web5

66 lines 2.86 kB
import type { DidCreateParams, DidMessageResult, DidResolveParams, ResponseStatus, Web5Agent } from '@enbox/agent'; import { DidInterface } from '@enbox/agent'; /** * Parameters for creating a DID, specifying the method, options for the DID method, and whether to * store the DID. * * @typeParam method - The DID method to use for creating the DID. * @typeParam options - Method-specific options for creating the DID. * @typeParam store - Indicates whether the newly created DID should be stored. */ export type DidCreateRequest = Pick<DidCreateParams, 'method' | 'options' | 'store'>; /** * The response from a DID creation request, including the operation's status and, if successful, * the created DID. */ export type DidCreateResponse = ResponseStatus & { /** The result of the DID creation operation, containing the newly created DID, if successful */ did?: DidMessageResult[DidInterface.Create]; }; /** * The response from resolving a DID, containing the DID Resolution Result. * * This type directly maps to the result of a DID resolution operation, providing detailed * information about the DID document, including any DID document metadata and DID resolution * metadata, */ export type DidResolveResponse = DidMessageResult[DidInterface.Resolve]; /** * The DID API is used to resolve DIDs. * * @beta */ export declare class DidApi { /** * Holds the instance of a {@link Web5Agent} that represents the current execution context for * the `DidApi`. This agent is used to process DID requests. */ private agent; /** The DID of the tenant under which DID operations are being performed. */ private connectedDid; constructor(options: { agent: Web5Agent; connectedDid: string; }); /** * Initiates the creation of a Decentralized Identifier (DID) using the specified method, options, * and storage preference. * * This method sends a request to the Web5 Agent to create a new DID based on the provided method, * with method-specific options. It also specifies whether the newly created DID should be stored. * * @param request - The request parameters for creating a DID, including the method, options, and * storage flag. * @returns A promise that resolves to a `DidCreateResponse`, which includes the operation's * status and, if successful, the newly created DID. */ create(request: DidCreateRequest): Promise<DidCreateResponse>; /** * Resolves a DID to a DID Resolution Result. * * @param didUri - The DID or DID URL to resolve. * @returns A promise that resolves to the DID Resolution Result. */ resolve(didUri: DidResolveParams['didUri'], options?: DidResolveParams['options']): Promise<DidResolveResponse>; } //# sourceMappingURL=did-api.d.ts.map