class Secp256k1::Keypair
- Secp256k1::Keypair
- Reference
- Object
Overview
Implements a Secp256k1
key pair containing a private and a public key.
Properties:
#private_key
(BigInt
): the secret as known as the private key.#public_key
(EC_Point
): the point on the elliptic curve as known as the public key.
key = Secp256k1::Keypair.new
key.get_secret
# => "53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97"
key.to_s
# => "e097fc69f0b92f711620511c07fefdd648e469df46b1e4385a00a1786f6bc55b7d9011bb589e883d8a7947cfb37dc6b3c8beae9c614cab4a83009bd9d8732a9f"
Defined in:
structs.crConstructors
-
.new(private_key : BigInt)
Generates a new keypair using a provided private key.
-
.new
Generates a new keypair using a fresh random private key.
Instance Method Summary
-
#get_secret
Gets the private key as hexadecimal formatted string literal.
-
#private_key : BigInt
The secret as known as the private key.
-
#private_key=(private_key : BigInt)
The secret as known as the private key.
-
#public_key : EC_Point
The point on the elliptic curve as known as the public key.
-
#public_key=(public_key : EC_Point)
The point on the elliptic curve as known as the public key.
-
#to_s
Gets the key formatted as uncompressed public key string.
Constructor Detail
Generates a new keypair using a provided private key.
Parameters:
#private_key
(BigInt
): the secret as known as the private key.
key = Secp256k1::Keypair.new BigInt.new("53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97", 16)
# => #<Secp256k1::Keypair:0x7f8be5611d80>
Generates a new keypair using a fresh random private key.
key = Secp256k1::Keypair.new
# => #<Secp256k1::Keypair:0x7f8be5611d80>
Instance Method Detail
Gets the private key as hexadecimal formatted string literal.
key.get_secret
# => "53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97"
The point on the elliptic curve as known as the public key.
The point on the elliptic curve as known as the public key.
Gets the key formatted as uncompressed public key string.
key.to_s
# => "e097fc69f0b92f711620511c07fefdd648e469df46b1e4385a00a1786f6bc55b7d9011bb589e883d8a7947cfb37dc6b3c8beae9c614cab4a83009bd9d8732a9f"