Skip to content

crypt.ed25519 #

TODO: is not working yet, info copied from keysafe in root dir, but we need easier to understand usable lib

TODO: maxux, please migrate all your functionality in relation to signing, ... to this module

fn new_private_key_25519 #

fn new_private_key_25519() PrivKey25519

struct PrivKey25519 #

struct PrivKey25519 {
pub:
	signkey_bytes []u8                 // signing key in bytes
	signkey       libsodium.SigningKey // master key (is a signing key)
	privkey       libsodium.PrivateKey // derivated from master key
	pubkey        PubKey25519
}

holds signing and private key private key is derivative from signing key signkey_bytes is the seed to generate a signing key from which can then generate priv key

fn (PrivKey25519) encrypt_for_remote #

fn (privkey PrivKey25519) encrypt_for_remote(pubkey PubKey25519, data []u8) ![]u8

encrypt data which can only be read by whoever has the private key for this public key

fn (PrivKey25519) decrypt #

fn (privkey PrivKey25519) decrypt(data []u8) []u8

verify a signed data and decrypt,

fn (PrivKey25519) sign #

fn (key PrivKey25519) sign(data []u8) []u8

sign data with our signing key. data is bytestr. output is []u8 bytestring. to get bytes from string do: mystring.bytes().

struct PubKey25519 #

struct PubKey25519 {
pub:
	ed_bytes    []u8 // for signing
	curve_bytes []u8 // target = remote public key (to encrypt) , also called X25519
}

fn (PubKey25519) verify #

fn (key PubKey25519) verify(signature []u8) bool

verify the signature