Class: SchnorrKeyPair ​
Defined in: pair.ts:36
Encapsulates paired CompressedSecp256k1PublicKey and Secp256k1SecretKey objects as a single SchnorrKeyPair object. SchnorrKeyPair
Implements ​
Constructors ​
Constructor ​
new SchnorrKeyPair(
params?):SchnorrKeyPair
Defined in: pair.ts:49
Creates an instance of Keys. Must provide a at least a secret key. Can optionally provide both a secret and public key, but must be a valid pair.
Parameters ​
params? ​
SchnorrKeyPairParams = {}
The parameters to initialize the Keys object.
Returns ​
SchnorrKeyPair
Throws ​
If neither a public key or secret key is provided.
Throws ​
If the public key is not a valid pair with the secret key.
Accessors ​
hasSecretKey ​
Get Signature ​
get hasSecretKey():
boolean
Defined in: pair.ts:126
Whether this key pair contains a secret key.
Returns ​
boolean
True if the secret key is present.
hex ​
Get Signature ​
get hex():
HexSchnorrKeyPair
Defined in: pair.ts:145
Get the Keys in hex format.
Returns ​
The Keys in hex format
multibase ​
Get Signature ​
get multibase():
MultibaseKeys
Defined in: pair.ts:156
Get the Keys in multibase format.
Returns ​
The Secp256k1SecretKey in multibase format
publicKey ​
Get Signature ​
get publicKey():
CompressedSecp256k1PublicKey
Defined in: pair.ts:118
Get the CompressedSecp256k1PublicKey.
Returns ​
The CompressedSecp256k1PublicKey object
Set Signature ​
set publicKey(
publicKey):void
Defined in: pair.ts:104
Set the CompressedSecp256k1PublicKey.
Throws ​
If the public key is not a valid pair with the secret key.
Parameters ​
publicKey ​
The CompressedSecp256k1PublicKey object
Returns ​
void
The public key associated with the SchnorrKeyPair (required).
Implementation of ​
raw ​
Get Signature ​
get raw():
RawSchnorrKeyPair
Defined in: pair.ts:134
Get the raw bytes of each key in the SchnorrKeyPair.
Returns ​
JSON object with the SchnorrKeyPair raw bytes.
secretKey ​
Get Signature ​
get secretKey():
Secp256k1SecretKey
Defined in: pair.ts:85
Get the Secp256k1SecretKey.
Throws ​
If the secret key is not available
Returns ​
The Secp256k1SecretKey object
The secret key associated with the SchnorrKeyPair (optional).
Implementation of ​
Methods ​
exportJSON() ​
exportJSON():
SchnorrKeyPairObject
Defined in: pair.ts:177
Exports the full key pair as a JSON object. Contains sensitive material.
Returns ​
The key pair as a JSON object
Throws ​
If the secret key is not available
toJSON() ​
toJSON():
object
Defined in: pair.ts:168
Safe JSON representation. Only includes the public key. Called implicitly by JSON.stringify(). Use exportJSON() for full serialization.
Returns ​
object
The JSON representation of the public key
publicKey ​
publicKey:
PublicKeyObject
equals() ​
staticequals(kp,otherKp):boolean
Defined in: pair.ts:260
Compares two Keys objects for equality.
Parameters ​
kp ​
SchnorrKeyPair
The main keys.
otherKp ​
SchnorrKeyPair
The other keys to compare.
Returns ​
boolean
True if the public key and secret key are equal, false otherwise.
fromBigInt() ​
staticfromBigInt(bint):SchnorrKeyPair
Defined in: pair.ts:239
Static method creates a new Keys (Secp256k1SecretKey/CompressedSecp256k1PublicKey) from bigint entropy.
Parameters ​
bint ​
bigint
The entropy in bigint form
Returns ​
SchnorrKeyPair
A new SchnorrKeyPair object
fromJSON() ​
staticfromJSON(keys):SchnorrKeyPair
Defined in: pair.ts:200
Static method creates a new Keys from a JSON object.
Parameters ​
keys ​
The JSON object to initialize the Keys.
Returns ​
SchnorrKeyPair
The initialized Keys object.
fromSecret() ​
staticfromSecret(data):SchnorrKeyPair
Defined in: pair.ts:212
Static method creates a new SchnorrKeyPair from a Secp256k1SecretKey object or secret key bytes.
Parameters ​
data ​
string | Bytes
The secret key bytes
Returns ​
SchnorrKeyPair
A new SchnorrKeyPair object
generate() ​
staticgenerate():SchnorrKeyPair
Defined in: pair.ts:268
Static method to generate a new random SchnorrKeyPair instance.
Returns ​
SchnorrKeyPair
A new Secp256k1SecretKey object.
toHex() ​
statictoHex(keyBytes):Hex
Defined in: pair.ts:250
Converts key bytes to a hex string.
Parameters ​
keyBytes ​
The key bytes (secret or public).
Returns ​
The key bytes as a hex string.