Class: SchnorrKeyPair ​
Defined in: pair.ts:40
Encapsulates a CompressedSecp256k1PublicKey and a Secp256k1SecretKey object as a single SchnorrKeyPair object. SchnorrKeyPair
Implements ​
Constructors ​
Constructor ​
new SchnorrKeyPair(
params):SchnorrKeyPair
Defined in: pair.ts:62
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 ​
hex ​
Get Signature ​
get hex():
HexSchnorrKeyPair
Defined in: pair.ts:151
Get the Keys in hex format.
Returns ​
The Keys in hex format
multibase ​
Get Signature ​
get multibase():
MultibaseKeys
Defined in: pair.ts:162
Get the Keys in multibase format.
Returns ​
The Secp256k1SecretKey in multibase format
publicKey ​
Get Signature ​
get publicKey():
CompressedSecp256k1PublicKey
Defined in: pair.ts:131
Get the CompressedSecp256k1PublicKey.
Returns ​
The CompressedSecp256k1PublicKey object
Set Signature ​
set publicKey(
publicKey):void
Defined in: pair.ts:112
Set the CompressedSecp256k1PublicKey.
Throws ​
If the public key is not a valid pair with the secret key.
Parameters ​
publicKey ​
The CompressedSecp256k1PublicKey object
Returns ​
void
Implementation of ​
raw ​
Get Signature ​
get raw():
RawSchnorrKeyPair
Defined in: pair.ts:140
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:93
Get the Secp256k1SecretKey.
Throws ​
If the secret key is not available
Returns ​
The Secp256k1SecretKey object
Throws ​
If the secret key is not available.
Implementation of ​
Methods ​
json() ​
json():
SchnorrKeyPairObject
Defined in: pair.ts:173
JSON representation of a Keys.
Returns ​
The Keys as a JSON object
Implementation of ​
equals() ​
staticequals(kp,otherKp):boolean
Defined in: pair.ts:243
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.
fromEntropy() ​
staticfromEntropy(entropy):SchnorrKeyPair
Defined in: pair.ts:222
Static method creates a new Keys (Secp256k1SecretKey/CompressedSecp256k1PublicKey) from bigint entropy.
Parameters ​
entropy ​
bigint
The entropy in bigint form
Returns ​
SchnorrKeyPair
A new SchnorrKeyPair object
fromJSON() ​
staticfromJSON(keys):SchnorrKeyPair
Defined in: pair.ts:185
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.
fromPrivateKey() ​
staticfromPrivateKey(data):SchnorrKeyPair
Defined in: pair.ts:197
Static method creates a new SchnorrKeyPair from a Secp256k1SecretKey object or secret key bytes.
Parameters ​
data ​
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:233
Converts key bytes to a hex string.
Parameters ​
keyBytes ​
The key bytes (secret or public).
Returns ​
The key bytes as a hex string.