Class: KeyPair
Defined in: keys.ts:307
A matched public/secret key pair.
Accessors
algorithm
Get Signature
get algorithm():
string
Defined in: keys.ts:383
Canonical algorithm string of the pair.
Throws
if the pair has been freed.
Returns
string
publicKey
Get Signature
get publicKey():
PublicKey
Defined in: keys.ts:367
The public key. The same object is returned on every call; it is freed together with the pair.
Throws
if the pair has been freed.
Returns
secretKey
Get Signature
get secretKey():
SecretKey
Defined in: keys.ts:375
The secret key. The same object is returned on every call; it is freed together with the pair.
Throws
if the pair has been freed.
Returns
Methods
[dispose]()
[dispose]():
void
Defined in: keys.ts:400
Supports using pair = ...; calls KeyPair.free.
Returns
void
free()
free():
void
Defined in: keys.ts:394
Frees the pair and any key objects obtained from it. Calling it again does nothing.
Returns
void
toCborBundle()
toCborBundle():
Uint8Array
Defined in: keys.ts:390
CBOR bundle of both keys (contains the secret).
Returns
Uint8Array
Throws
if the pair has been freed.
toString()
toString():
string
Defined in: keys.ts:404
Short description with the algorithm; contains no key material.
Returns
string
fromCborBundle()
staticfromCborBundle(data):KeyPair
Defined in: keys.ts:325
Parses a quantum-safe-py KeyPair.to_cbor_bundle() blob.
Parameters
data
Uint8Array
CBOR bundle holding both keys.
Returns
KeyPair
The key pair.
Throws
if data is not a valid key pair bundle.
Throws
if a key was written by a newer format version.
Throws
if data is not bytes.
fromKeys()
staticfromKeys(publicKey,secretKey):KeyPair
Defined in: keys.ts:339
Assembles a pair from separately held keys (for example a public key from one place and a secret key from another). The keys are copied; the caller still owns, and should free, the arguments. The intermediate CBOR copies of the keys are zeroed before returning.
Parameters
publicKey
The public half.
secretKey
The secret half; must have the same algorithm as publicKey.
Returns
KeyPair
A new key pair.
Throws
if the algorithms differ.
Throws
if an argument has the wrong type or has been freed.