Expand description

Wownero public and private keys.

Support for (de)serializable and manipulation of Wownero public and private keys.

Parsing

use std::str::FromStr;
use wownero::util::key::{Error, PrivateKey, PublicKey};

// parse private key from hex
let privkey = PrivateKey::from_str("77916d0cd56ed1920aef6ca56d8a41bac915b68e4c46a589e0956e27a7b77404")?;
// parse public key from hex
let pubkey_parsed = PublicKey::from_str("eac2cc96e0ae684388e3185d5277e51313bff98b9ad4a12dcd9205f20d37f1a3")?;

// or get the public key from private key
let pubkey = PublicKey::from_private_key(&privkey);

assert_eq!(pubkey_parsed, pubkey);

Arithmetic

Support for private key addition and public key addition.

use std::str::FromStr;
use wownero::util::key::{Error, PrivateKey, PublicKey};

let priv1 = PrivateKey::from_str("77916d0cd56ed1920aef6ca56d8a41bac915b68e4c46a589e0956e27a7b77404")?;
let priv2 = PrivateKey::from_str("8163466f1883598e6dd14027b8da727057165da91485834314f5500a65846f09")?;
let priv_res = priv1 + priv2;
assert_eq!("f8f4b37bedf12a2178c0adcc2565b42a212c133861cb28cdf48abf310c3ce40d", priv_res.to_string());

let pub1 = PublicKey::from_private_key(&priv1);
let pub2 = PublicKey::from_private_key(&priv2);
let pub_res = pub1 + pub2;
assert_eq!("d35ad191b220a627977bb2912ea21fd59b24937f46c1d3814dbcb7943ff1f9f2", pub_res.to_string());

let pubkey = PublicKey::from_private_key(&priv_res);
assert_eq!(pubkey, pub_res);

Structs

Two private keys representing the view and the spend keys.

A private key, a valid curve25519 scalar.

A public key, a valid edward point on the curve.

View pair to scan transaction outputs and retreive amounts, but can’t spend outputs.

Enums

Potential errors encountered during key decoding.

Constants

Alternative generator H used for pedersen commitments, as defined in rctTypes.h in the Wownero codebase.