@did-btc1/method
    Preparing search index...

    Interface KeyManager

    The interface for the Btc1KeyManager class. KeyManager

    interface KeyManager {
        activeKeyUri?: string;
        digest(data: Uint8Array): Bytes;
        exportKey(keyUri?: string): Promise<undefined | KeyPair>;
        getPublicKey(keyUri: string): Promise<PublicKey>;
        importKey(
            keyPair: KeyPair,
            options: Btc1KeyManagerOptions,
        ): Promise<string>;
        sign(data: Hex, keyUri?: string): Promise<Bytes>;
        verify(signature: Bytes, data: Hex, keyUri?: string): Promise<boolean>;
    }

    Implemented by

    Index

    Properties

    activeKeyUri?: string

    The URI of the active key.

    Methods

    • Exports the full key pair from the key store.

      Parameters

      • OptionalkeyUri: string

        The URI of the key to export.

      Returns Promise<undefined | KeyPair>

      The key pair associated with the key URI.

      If the key is not found in the key store.

    • Gets the public key of a key pair.

      Parameters

      • keyUri: string

        The URI of the key to get the public key for.

      Returns Promise<PublicKey>

      The public key of the key pair.

    • Signs a message with a key pair.

      Parameters

      • data: Hex

        The data to sign.

      • OptionalkeyUri: string

        The URI of the key to sign the data with.

      Returns Promise<Bytes>

      The signature of the input data.

    • Verifies if a signature was produced by a key pair.

      Parameters

      • signature: Bytes

        The signature to verify.

      • data: Hex

        The data that was signed.

      • OptionalkeyUri: string

        The URI of the key to use for verification.

      Returns Promise<boolean>

      A promise that resolves if the signature is valid, and rejects otherwise.