Generate

Trait Generate 

Source
pub trait Generate: KeyMaterial {
    // Required methods
    fn new() -> Result<Self, Error>
       where Self: Sized;
    fn new_with_seed(seed: &[u8]) -> Result<Self, Error>
       where Self: Sized;
    fn from_public_key(public_key: &[u8; 32]) -> Result<Self, Error>
       where Self: Sized;
    fn from_secret_key(private_key: &[u8; 32]) -> Result<Self, Error>
       where Self: Sized;
}
Expand description

A trait for types that support deterministic key generation.

Required Methods§

Source

fn new() -> Result<Self, Error>
where Self: Sized,

Generates a new random key.

Returns a Result containing the new key, or an Error if the operation fails.

Source

fn new_with_seed(seed: &[u8]) -> Result<Self, Error>
where Self: Sized,

Generates a new key deterministically using the given seed.

Returns a Result containing the new key, or an Error if the operation fails.

Source

fn from_public_key(public_key: &[u8; 32]) -> Result<Self, Error>
where Self: Sized,

Generates a new instance from an existing public key.

Returns a Result containing the new instance, or an Error if the operation fails.

Source

fn from_secret_key(private_key: &[u8; 32]) -> Result<Self, Error>
where Self: Sized,

Generates a new instance from an existing secret key.

Returns a Result containing the new instance, or an Error if the operation fails.

Implementors§