Interface DidMethodApi<TKms, TDid, TOptions>

Defines the API for a specific DID method. It includes functionalities for creating and resolving DIDs.

Typeparam

T - The type of the DID instance associated with this method.

Typeparam

O - The type of the options used for creating the DID.

interface DidMethodApi<TKms, TDid, TOptions> {
    new DidMethodApinew (): DidMethod;
    new DidMethodApinew (): DidMethod;
    methodName: string;
    create(params): Promise<TDid>;
    getSigningMethod(params): Promise<DidVerificationMethod>;
    resolve(didUri, options?): Promise<DidResolutionResult>;
}

Type Parameters

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

methodName: string

The name of the DID method.

For example, in the DID did:example:123456, "example" would be the method name.

Methods

  • Creates a new DID.

    This function should generate a new DID in accordance with the DID method specification being implemented, using the provided keyManager, and optionally, any provided options.

    Parameters

    • params: {
          keyManager?: TKms;
          options?: TOptions;
      }

      The parameters used to create the DID.

      • Optional keyManager?: TKms

        Optional. The cryptographic API used for key management.

      • Optional options?: TOptions

        Optional. The options used for creating the DID.

    Returns Promise<TDid>

    A promise that resolves to the newly created DID instance.

  • Given a DID Document, return the verification method that will be used for signing messages and credentials.

    If given, the methodId parameter is used to select the verification method. If not given, a DID method specific approach is taken to selecting the verification method to return.

    Parameters

    • params: {
          didDocument: DidDocument;
          methodId?: string;
      }

      The parameters for the getSigningMethod operation.

      • didDocument: DidDocument

        DID Document to get the verification method from.

      • Optional methodId?: string

        ID of the verification method to use for signing.

    Returns Promise<DidVerificationMethod>

    A promise that resolves to the erification method to use for signing.

  • Resolves a DID URI.

    This function should resolve the DID URI in accordance with the DID method specification being implemented, using the provided options.

    Parameters

    • didUri: string

      The DID URI to be resolved.

    • Optional options: DidResolutionOptions

      Optional. The options used for resolving the DID.

    Returns Promise<DidResolutionResult>

    A DidResolutionResult object containing the DID document and metadata or an error.