Skip to content

crypto.ecdsa #

fn generate_key #

fn generate_key() !(PublicKey, PrivateKey)

Generate a new key pair

fn new_key_from_seed #

fn new_key_from_seed(seed []u8) !PrivateKey

Create a new private key from a seed

struct PrivateKey #

struct PrivateKey {
	key &C.EC_KEY
}

fn (PrivateKey) sign #

fn (priv_key PrivateKey) sign(message []u8) ![]u8

Sign a message with private key

fn (PrivateKey) seed #

fn (priv_key PrivateKey) seed() ![]u8

Get the seed (private key bytes)

fn (PrivateKey) public_key #

fn (priv_key PrivateKey) public_key() !PublicKey

Get the public key from private key

fn (PrivateKey) equal #

fn (priv_key PrivateKey) equal(other PrivateKey) bool

Compare two private keys

struct PublicKey #

struct PublicKey {
	key &C.EC_KEY
}

fn (PublicKey) verify #

fn (pub_key PublicKey) verify(message []u8, sig []u8) !bool

Verify a signature with public key

fn (PublicKey) equal #

fn (pub_key PublicKey) equal(other PublicKey) bool

Compare two public keys