Trait diem_sdk::crypto::Uniform

pub trait Uniform {
    // Required method
    fn generate<R>(rng: &mut R) -> Self
       where R: RngCore + CryptoRng;

    // Provided method
    fn generate_for_testing() -> Self
       where Self: Sized { ... }
}
Expand description

A type family for schemes which know how to generate key material from a cryptographically-secure CryptoRng.

Required Methods§

fn generate<R>(rng: &mut R) -> Selfwhere R: RngCore + CryptoRng,

Generate key material from an RNG. This should generally not be used for production purposes even with a good source of randomness. When possible use hardware crypto to generate and store private keys.

Provided Methods§

fn generate_for_testing() -> Selfwhere Self: Sized,

Generate a random key using the shared TEST_SEED

Implementations on Foreign Types§

§

impl<S, P> Uniform for (S, P)where S: Uniform, P: for<'a> From<&'a S>,

A pair consisting of a private and public key

§

fn generate<R>(rng: &mut R) -> (S, P)where R: RngCore + CryptoRng,

Implementors§

§

impl Uniform for Ed25519PrivateKey

§

impl Uniform for MultiEd25519PrivateKey

§

impl Uniform for PrivateKey

§

impl<S, P> Uniform for KeyPair<S, P>where S: Uniform, P: for<'a> From<&'a S>,