VRFKeyPair

Trait VRFKeyPair 

Source
pub trait VRFKeyPair<const OUTPUT_SIZE: usize> {
    type Proof: VRFProof<OUTPUT_SIZE, PublicKey = Self::PublicKey>;
    type PrivateKey: VRFPrivateKey<PublicKey = Self::PublicKey>;
    type PublicKey: VRFPublicKey<PrivateKey = Self::PrivateKey>;

    // Required methods
    fn generate<R: AllowedRng>(rng: &mut R) -> Self;
    fn prove(&self, input: &[u8]) -> Self::Proof;

    // Provided method
    fn output(&self, input: &[u8]) -> ([u8; OUTPUT_SIZE], Self::Proof) { ... }
}
Expand description

A keypair for a verifiable random function (VRF).

Required Associated Types§

Source

type Proof: VRFProof<OUTPUT_SIZE, PublicKey = Self::PublicKey>

Source

type PrivateKey: VRFPrivateKey<PublicKey = Self::PublicKey>

Source

type PublicKey: VRFPublicKey<PrivateKey = Self::PrivateKey>

Required Methods§

Source

fn generate<R: AllowedRng>(rng: &mut R) -> Self

Generate a new keypair using the given RNG.

Source

fn prove(&self, input: &[u8]) -> Self::Proof

Generate a proof for the given input.

Provided Methods§

Source

fn output(&self, input: &[u8]) -> ([u8; OUTPUT_SIZE], Self::Proof)

Compute both hash and proof for the given input.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§