Creates an instance of Btc1KeyManager.
The parameters to initialize the key manager.
Params for initializing a Btc1KeyManager class instance.
Optional
controller?: stringAn optional property to specify the DID controller.\
Optional
id?: stringAn optional property to specify the DID contoller id.
Optional
keys?: SchnorrKeyPairAn optional property to pass in an initial key pair
Optional
keyUri?: KeyIdentifierAn 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.
Optional
store?: 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.
Optional
activeThe 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.
Static
instanceGets the singleton instance of the Btc1KeyManager.
The singleton instance of the Btc1KeyManager.
Computes the hash of the given data.
The data to hash.
The hash of the data.
Gets the key pair from the key store and returns a PublicKey.
Optional
keyUri: stringThe URI of the key to get the public key for.
The public key associated with the key URI.
Imports a keypair to the store.
The keypair to import.
The URI of the key to import.
Relevant import options.
Optional
active?: booleanOptional
importKey?: booleanA promise that resolves to the key identifier of the imported key.
Signs the given data using the key associated with the key URI.
The data to sign.
Optional
keyUri: stringThe URI of the key to sign the data with.
A promise resolving to the signature of the data.
Signs a transaction using the key associated with the key URI.
The transaction hex to sign.
Optional
keyUri: stringThe URI of the key to sign the transaction with.
A promise resolving to the signed transaction hex.
Verifies a signature using the key associated with the key URI.
The signature to verify.
The data to verify the signature with.
Optional
keyUri: stringThe URI of the key to verify the signature with.
A promise resolving to a boolean indicating the verification result.
Static
computeComputes the key URI of a given keypair.
The fragment identifier (e.g. 'key-1').
Optional
controller: stringThe DID controller (e.g. 'did:btc1:xyz').
A full DID fragment URI (e.g. 'did:btc1:xyz#key-1')
Static
getRetrieves a keypair from the key store using the provided key URI.
Optional
keyUri: stringThe URI of the keypair to retrieve.
The retrieved keypair, or undefined if not found.
Static
initializeInitializes a singleton Btc1KeyManager instance.
The keypair used to initialize the key manager.
Static
toComputes a multibase-compliant URI from a key.
A multibase URI (e.g. 'urn:mb:zQ3s...')
Class for managing cryptographic keys for the Btc1 DID method. Btc1KeyManager