Interface: KeyManager ​
Defined in: interface.ts:48
Interface for key management operations. KeyManager
Properties ​
activeKeyId? ​
readonlyoptionalactiveKeyId?:string
Defined in: interface.ts:50
The ID of the active key.
Methods ​
digest() ​
digest(
data):Bytes
Defined in: interface.ts:116
Compute a SHA-256 hash of the given data.
Parameters ​
data ​
Uint8Array
The data to hash.
Returns ​
The hash bytes.
generateKey() ​
generateKey(
options?):string
Defined in: interface.ts:123
Generate a new key pair and store it.
Parameters ​
options? ​
Generation options.
Returns ​
string
The key identifier of the generated key.
getPublicKey() ​
getPublicKey(
id?):Bytes
Defined in: interface.ts:88
Get the compressed public key bytes for a key.
Parameters ​
id? ​
string
Key identifier. Uses active key if omitted.
Returns ​
Compressed secp256k1 public key bytes.
Throws ​
If key not found or no active key set.
importKey() ​
importKey(
keyPair,options?):string
Defined in: interface.ts:66
Import a key pair. May be public-key-only for watch-only entries.
Parameters ​
keyPair ​
The key pair to import.
options? ​
Import options.
Returns ​
string
The key identifier of the imported key.
Throws ​
If the key already exists.
listKeys() ​
listKeys():
string[]
Defined in: interface.ts:80
List all key identifiers.
Returns ​
string[]
Array of key identifiers.
removeKey() ​
removeKey(
id,options?):void
Defined in: interface.ts:74
Remove a key from the store.
Parameters ​
id ​
string
The key identifier to remove.
options? ​
Removal options.
force? ​
boolean
Returns ​
void
Throws ​
If removing the active key without force, or key not found.
setActiveKey() ​
setActiveKey(
id):void
Defined in: interface.ts:57
Set the active key.
Parameters ​
id ​
string
The key identifier to set as active.
Returns ​
void
Throws ​
If the key is not found.
sign() ​
sign(
data,id?,options?):Bytes
Defined in: interface.ts:98
Sign data using the specified key.
Parameters ​
data ​
The data to sign.
id? ​
string
Key identifier. Uses active key if omitted.
options? ​
Signing options (scheme defaults to 'schnorr').
Returns ​
The signature bytes.
Throws ​
If key not found, no active key, or key cannot sign.
verify() ​
verify(
signature,data,id?,options?):boolean
Defined in: interface.ts:109
Verify a signature using the specified key.
Parameters ​
signature ​
The signature to verify.
data ​
The data that was signed.
id? ​
string
Key identifier. Uses active key if omitted.
options? ​
Verification options (scheme defaults to 'schnorr').
Returns ​
boolean
True if the signature is valid.
Throws ​
If key not found or no active key set.