ECVRF

Trait ECVRF 

Source
pub trait ECVRF<PrivateKey, PublicKey> {
    type Error;

    // Required methods
    fn prove(
        &mut self,
        pkey: PrivateKey,
        alpha_string: &[u8],
    ) -> Result<Vec<u8>, Self::Error>;
    fn proof_to_hash(
        &mut self,
        pi_string: &[u8],
    ) -> Result<Vec<u8>, Self::Error>;
    fn verify(
        &mut self,
        public_key: PublicKey,
        alpha_string: &[u8],
        pi_string: &[u8],
    ) -> Result<Vec<u8>, Self::Error>;
}
Expand description

A trait containing common capabilities for ECVRF implementations

Required Associated Types§

Required Methods§

Source

fn prove( &mut self, pkey: PrivateKey, alpha_string: &[u8], ) -> Result<Vec<u8>, Self::Error>

Generates proof from a private key and a message

§Arguments:
  • pkey: a private key
  • alpha_string: octet string message represented by a slice
§Returns:
  • if successful, a vector of octets representing the VRF proof
Source

fn proof_to_hash(&mut self, pi_string: &[u8]) -> Result<Vec<u8>, Self::Error>

Generates VRF hash output from the provided proof

§Arguments:
  • pi_string: generated VRF proof
§Returns:
  • the VRF hash output
Source

fn verify( &mut self, public_key: PublicKey, alpha_string: &[u8], pi_string: &[u8], ) -> Result<Vec<u8>, Self::Error>

Verifies the provided VRF proof and computes the VRF hash output

§Arguments:
  • public_key: a public key
  • alpha_string: VRF hash input, an octet string
  • pi_string: proof to be verified, an octet string
§Returns:
  • if successful, a vector of octets with the VRF hash output

Implementors§

Source§

impl ECVRF<&[u8], &[u8]> for ECVRF