@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

      • params: KeyManagerParams = {}

        The parameters to initialize the key manager.

        Params for initializing a Btc1KeyManager class instance.

        • Optionalcontroller?: string

          An optional property to specify the DID controller.\

        • Optionalid?: string

          An optional property to specify the DID contoller id.

        • Optionalkeys?: SchnorrKeyPair

          An optional property to pass in an initial key pair

        • 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.

        • Optionalstore?: KeyValueStore<KeyIdentifier, SchnorrMultikey>

          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.

      Returns Btc1KeyManager

    Properties

    activeKeyUri?: string

    The activeKeyUri property is a string that represents the URI of the currently active key. It is used to identify the key that will be used for signing and verifying operations. This property is optional and can be set to a specific key URI when initializing the Btc1KeyManager instance. If not set, the key manager will use the default key URI.

    Accessors

    Methods

    • Exports the full multikeypair from the key store.

      Parameters

      • OptionalkeyUri: string

      Returns Promise<undefined | SchnorrMultikey>

      The key pair associated with the key URI.

      If the key is not found in the key store.

    • 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.

    • Signs a transaction using the key associated with the key URI.

      Parameters

      • txHex: Hex

        The transaction hex to sign.

      • OptionalkeyUri: string

        The URI of the key to sign the transaction with.

      Returns Promise<Hex>

      A promise resolving to the signed transaction hex.

    • Verifies a signature using the key associated with the key URI.

      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.

      Parameters

      • id: string

        The fragment identifier (e.g. 'key-1').

      • Optionalcontroller: string

        The DID controller (e.g. 'did:btc1:xyz').

      Returns string

      A full DID fragment URI (e.g. 'did:btc1:xyz#key-1')

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

      Parameters

      • OptionalkeyUri: string

        The URI of the keypair to retrieve.

      Returns Promise<undefined | SchnorrMultikey>

      The retrieved keypair, or undefined if not found.

    • Computes a multibase-compliant URI from a key.

      Parameters

      • data: PublicKey | SchnorrKeyPair | Multibase<"zQ3s">

      Returns string

      A multibase URI (e.g. 'urn:mb:zQ3s...')