Trait vrf::VRF

source · []
pub trait VRF<PublicKey, SecretKey> {
    type Error;
    fn prove(
        &mut self,
        x: SecretKey,
        alpha: &[u8]
    ) -> Result<Vec<u8>, Self::Error>; fn verify(
        &mut self,
        y: PublicKey,
        pi: &[u8],
        alpha: &[u8]
    ) -> Result<Vec<u8>, Self::Error>; }
Expand description

A trait containing the common capabilities for all Verifiable Random Functions (VRF) implementations.

Associated Types

Required methods

Generates proof from a secret key and a message.

Arguments
  • x - A secret key.
  • alpha - A slice representing the message in octets.
Returns
  • If successful, a vector of octets representing the proof of the VRF.

Verifies the provided VRF proof and computes the VRF hash output.

Arguments
  • y - A public key.
  • pi - A slice of octets representing the VRF proof.
Returns
  • If successful, a vector of octets with the VRF hash output.

Implementors

VRFs are objects capable of generating and verifying proofs.