drand_verify

Trait Pubkey

Source
pub trait Pubkey: Sized {
    type This;
    type ThisCompressed;
    type Other;

    // Required methods
    fn msg_to_curve(msg: &[u8]) -> Self::Other;
    fn from_fixed(data: Self::ThisCompressed) -> Result<Self, InvalidPoint>;
    fn from_fixed_unchecked(
        data: Self::ThisCompressed,
    ) -> Result<Self, InvalidPoint>;
    fn from_variable(data: &[u8]) -> Result<Self, InvalidPoint>;
    fn verify_step2(
        &self,
        signature: &[u8],
        msg_on_curve: &Self::Other,
    ) -> Result<bool, VerificationError>;

    // Provided method
    fn verify(
        &self,
        round: u64,
        previous_signature: &[u8],
        signature: &[u8],
    ) -> Result<bool, VerificationError> { ... }
}

Required Associated Types§

Source

type This

The curve (G1 or G2) on which the public key lives

Source

type ThisCompressed

The type in which this point is expressed in binary data (either [u8; 48] or [u8; 96])

Source

type Other

The other curve (G2 or G1) on which the signature lives

Required Methods§

Source

fn msg_to_curve(msg: &[u8]) -> Self::Other

Source

fn from_fixed(data: Self::ThisCompressed) -> Result<Self, InvalidPoint>

Source

fn from_fixed_unchecked( data: Self::ThisCompressed, ) -> Result<Self, InvalidPoint>

Source

fn from_variable(data: &[u8]) -> Result<Self, InvalidPoint>

Source

fn verify_step2( &self, signature: &[u8], msg_on_curve: &Self::Other, ) -> Result<bool, VerificationError>

This is part of verify but you can call it explicitely in case you already have a message hashed to the curve.

Provided Methods§

Source

fn verify( &self, round: u64, previous_signature: &[u8], signature: &[u8], ) -> Result<bool, VerificationError>

The high level verification method for a drand beacon.

previous_signature should be set to an empty slice for the unchained mode.

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§