Class: MultikeyApi ​
Defined in: packages/api/src/crypto.ts:301
Schnorr multikey operations.
Optionally stateful: call use to set a current multikey, then call sign, verify, or toVerificationMethod without passing an explicit instance. Pass an explicit instance to any method to override the current one for that call.
Constructors ​
Constructor ​
new MultikeyApi():
MultikeyApi
Returns ​
MultikeyApi
Accessors ​
current ​
Get Signature ​
get current():
SchnorrMultikey|undefined
Defined in: packages/api/src/crypto.ts:305
The currently active multikey, or undefined if none is set.
Returns ​
SchnorrMultikey | undefined
Methods ​
clear() ​
clear():
void
Defined in: packages/api/src/crypto.ts:320
Clear the current multikey.
Returns ​
void
create() ​
create(
id,controller,keyPair):SchnorrMultikey
Defined in: packages/api/src/crypto.ts:331
Create a new Schnorr multikey from a keypair.
Parameters ​
id ​
string
The multikey ID.
controller ​
string
The multikey controller.
keyPair ​
The Schnorr keypair to use.
Returns ​
The created Schnorr multikey.
fromKms() ​
fromKms(
id,controller,keyId,kms):Multikey
Defined in: packages/api/src/crypto.ts:363
Convenience: resolve a key from the KMS and create a multikey in one step.
Parameters ​
id ​
string
The multikey ID.
controller ​
string
The multikey controller DID.
keyId ​
string
The KMS key identifier to resolve.
kms ​
The KeyManagerApi instance holding the key.
Returns ​
The created Multikey (verification-only; public key from KMS).
fromPublicKey() ​
fromPublicKey(
params):Multikey
Defined in: packages/api/src/crypto.ts:351
Create a verification-only multikey from public key bytes.
Parameters ​
params ​
The id, controller, and publicKeyBytes.
Returns ​
The created Multikey.
fromSecretKey() ​
fromSecretKey(
id,controller,secretKeyBytes):SchnorrMultikey
Defined in: packages/api/src/crypto.ts:342
Create a Schnorr multikey from raw secret key bytes.
Parameters ​
id ​
string
The multikey ID.
controller ​
string
The multikey controller.
secretKeyBytes ​
The secret key bytes.
Returns ​
The created Schnorr multikey.
fromVerificationMethod() ​
fromVerificationMethod(
verificationMethod):SchnorrMultikey
Defined in: packages/api/src/crypto.ts:373
Reconstruct a multikey from a DID document's verification method.
Parameters ​
verificationMethod ​
The verification method to convert.
Returns ​
The reconstructed multikey.
sign() ​
sign(
data,mk?):Bytes
Defined in: packages/api/src/crypto.ts:393
Sign bytes via the multikey (requires secret). Uses the current multikey when mk is omitted.
Parameters ​
data ​
The data to sign.
mk? ​
Optional explicit multikey; defaults to current.
Returns ​
toVerificationMethod() ​
toVerificationMethod(
mk?):DidVerificationMethod
Defined in: packages/api/src/crypto.ts:382
Produce a DID Verification Method JSON from a multikey. Uses the current multikey when mk is omitted.
Parameters ​
mk? ​
Optional explicit multikey; defaults to current.
Returns ​
use() ​
use(
mk):this
Defined in: packages/api/src/crypto.ts:314
Set the current multikey for subsequent operations.
Parameters ​
mk ​
The multikey to activate.
Returns ​
this
this for chaining.
verify() ​
verify(
data,signature,mk?):boolean
Defined in: packages/api/src/crypto.ts:405
Verify signature via multikey. Uses the current multikey when mk is omitted.
Parameters ​
data ​
The data that was signed.
signature ​
The signature to verify.
mk? ​
Optional explicit multikey; defaults to current.
Returns ​
boolean