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

    Class Btc1KeyManager

    Class for managing cryptographic keys for the Btc1 DID method. Btc1KeyManager

    Implements

    Index

    Constructors

    • Creates an instance of Btc1KeyManager.

      Parameters

      • Optionalparams: KeyManagerParams

        The parameters to initialize the key manager.

        Params for initializing a Btc1KeyManager class instance.

        • Optionalkeys?: KeyPair

          An optional property to pass in an initial key pair

        • OptionalkeyStore?: KeyValueStore<KeyIdentifier, KeyPair>

          An optional property to specify a custom KeyValueStore instance for key management. If not provided, Btc1KeyManager uses a default MemoryStore instance. This store is responsible for managing cryptographic keys, allowing them to be retrieved, stored, and managed during cryptographic operations.

        • OptionalkeyUri?: KeyIdentifier

          An optional property to specify a key URI for the key manager. If not provided, the key manager will generate a key URI based on the public key of the key pair.

      Returns Btc1KeyManager

    Properties

    activeKeyUri?: string

    The URI of the active key.

    Methods

    • Gets the key pair from the key store and returns a PublicKey.

      Parameters

      • OptionalkeyUri: string

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

      Returns Promise<PublicKey>

      The public key associated with the key URI.

    • Signs the given data using the key associated with the key URI.

      Parameters

      • data: Hex

        The data to sign.

      • OptionalkeyUri: string

        The URI of the key to sign the data with.

      Returns Promise<Bytes>

      A promise resolving to the signature of the data.

    • Verifies a signature using the key associated with the key URI. See KeyManager.verify for more details.

      Parameters

      • signature: Bytes

        The signature to verify.

      • data: Hex

        The data to verify the signature with.

      • OptionalkeyUri: string

        The URI of the key to verify the signature with.

      Returns Promise<boolean>

      A promise resolving to a boolean indicating the verification result.

    • Computes the key URI of a given keypair. See KeyManager.computeKeyUri for more details.

      Parameters

      • data: PublicKey | KeyPair | Multibase<"z66p">

        The keypair to compute the URI for/

      Returns string

      The URI of the keypair/

    • Retrieves a keypair from the key store using the provided key URI.

      Parameters

      • keyUri: string

        The URI of the keypair to retrieve.

      Returns Promise<undefined | KeyPair>

      The retrieved keypair, or undefined if not found.

    • Initializes a new Btc1KeyManager instance with the provided ID and controller.

      Parameters

      • id: string

        The ID of the key manager.

      • controller: string

        The controller of the key manager.

      • OptionalkeyPair: KeyPair

        The keypair used to initialize the key manager (optional).

      Returns Promise<Btc1KeyManager>

      A new Btc1KeyManager instance.

      If the ID or controller is not provided.