Interface: KeyManager ​
Defined in: interface.ts:11
The interface for the Kms class. KeyManager
Properties ​
activeKeyId? ​
readonlyoptionalactiveKeyId:string
Defined in: interface.ts:17
The ID of the active key.
Methods ​
digest() ​
digest(
data):Bytes
Defined in: interface.ts:79
Computes the hash of the given data.
Parameters ​
data ​
Uint8Array
The data to hash.
Returns ​
The hash of the data.
generateKey() ​
generateKey():
string
Defined in: interface.ts:85
Generates a new key pair and stores it in the key store.
Returns ​
string
The identifier of the newly generated key.
getPublicKey() ​
getPublicKey(
id?):Bytes
Defined in: interface.ts:55
Gets the public key associated with the ID or active key.
Parameters ​
id? ​
string
The ID of the key to get the public key for.
Returns ​
A promise resolving to the public key bytes.
importKey() ​
importKey(
keyPair,options):string
Defined in: interface.ts:33
Import a key pair.
Parameters ​
keyPair ​
The secret key to import.
options ​
The options for importing the key pair.
id? ​
string
The ID of the key to import (optional).
setActive? ​
boolean
Whether to set the key as active (optional, default: false).
Returns ​
string
A promise that resolves to the key identifier of the imported key.
listKeys() ​
listKeys():
string[]
Defined in: interface.ts:48
Lists all key identifiers in the key store.
Returns ​
string[]
An array of key identifiers.
removeKey() ​
removeKey(
id,options):void
Defined in: interface.ts:42
Removes a key from the key store.
Parameters ​
id ​
string
The key identifier of the key to remove.
options ​
The options for removing the key.
force? ​
boolean
Whether to force the removal of the key.
Returns ​
void
A promise that resolves when the key is removed.
setActiveKey() ​
setActiveKey(
id):void
Defined in: interface.ts:23
Set the active key id.
Parameters ​
id ​
string
The key id to set as active.
Returns ​
void
sign() ​
sign(
data,id?):Bytes
Defined in: interface.ts:63
Signs the given data using the key associated with the key ID.
Parameters ​
data ​
The data to sign.
id? ​
string
The ID of the key to sign the data with.
Returns ​
A promise resolving to the signature of the data.
verify() ​
verify(
signature,data,id?):boolean
Defined in: interface.ts:72
Verifies a signature using the key associated with the key ID.
Parameters ​
signature ​
The signature to verify.
data ​
The data to verify the signature with.
id? ​
string
The ID of the key to verify the signature with.
Returns ​
boolean
A promise resolving to a boolean indicating the verification result.