Class: KeyManagerApi ​
Defined in: packages/api/src/kms.ts:21
Key management operations sub-facade.
Wraps a KeyManager interface. By default uses the built-in Kms implementation; a custom implementation can be injected via ApiConfig.
Constructors ​
Constructor ​
new KeyManagerApi(
kms?):KeyManagerApi
Defined in: packages/api/src/kms.ts:26
Create a new KeyManagerApi, optionally backed by a custom KeyManager.
Parameters ​
kms? ​
Returns ​
KeyManagerApi
Properties ​
kms ​
readonlykms:KeyManager
Defined in: packages/api/src/kms.ts:23
The backing KeyManager instance.
Methods ​
digest() ​
digest(
data):Bytes
Defined in: packages/api/src/kms.ts:92
Compute a SHA-256 digest.
Parameters ​
data ​
Uint8Array
Returns ​
export() ​
export(
id):SchnorrKeyPair
Defined in: packages/api/src/kms.ts:55
Export a Schnorr keypair from the KMS. Only supported when the backing KMS is the built-in Kms class.
Parameters ​
id ​
string
Returns ​
Throws ​
If the backing KMS does not support key export.
generateKey() ​
generateKey(
options?):string
Defined in: packages/api/src/kms.ts:31
Generate a new key directly in the KMS.
Parameters ​
options? ​
Returns ​
string
getPublicKey() ​
getPublicKey(
id?):Bytes
Defined in: packages/api/src/kms.ts:41
Get the public key bytes for a key identifier.
Parameters ​
id? ​
string
Returns ​
import() ​
import(
kp,options?):string
Defined in: packages/api/src/kms.ts:46
Import a Schnorr keypair into the KMS.
Parameters ​
kp ​
options? ​
Returns ​
string
listKeys() ​
listKeys():
string[]
Defined in: packages/api/src/kms.ts:66
List all managed key identifiers.
Returns ​
string[]
removeKey() ​
removeKey(
id,options?):void
Defined in: packages/api/src/kms.ts:71
Remove a key from the KMS.
Parameters ​
id ​
string
options? ​
force? ​
boolean
Returns ​
void
setActive() ​
setActive(
id):void
Defined in: packages/api/src/kms.ts:36
Set the active key by its identifier.
Parameters ​
id ​
string
Returns ​
void
sign() ​
sign(
data,id?,options?):Bytes
Defined in: packages/api/src/kms.ts:81
Sign data via the KMS.
Parameters ​
data ​
The data to sign (must be non-empty).
id? ​
string
Optional key identifier; uses the active key if omitted.
options? ​
Signing options (scheme defaults to 'schnorr').
Returns ​
verify() ​
verify(
signature,data,id?,options?):boolean
Defined in: packages/api/src/kms.ts:87
Verify a signature via the KMS.
Parameters ​
signature ​
data ​
id? ​
string
options? ​
Returns ​
boolean