Skip to main content

SignatureScheme

Trait SignatureScheme 

Source
pub trait SignatureScheme: Send + Sync {
    type ValidatorId: ValidatorId;
    type Signature: Signature;
    type AggregateSignature: Signature;
    type Signer: Signer<ValidatorId = Self::ValidatorId, Signature = Self::Signature>;

    // Required methods
    fn verify(
        &self,
        validator: Self::ValidatorId,
        msg: &[u8],
        sig: &Self::Signature,
    ) -> bool;
    fn aggregate(sigs: &[Self::Signature]) -> Self::AggregateSignature;
    fn verify_aggregate(
        &self,
        signers: &[Self::ValidatorId],
        msg: &[u8],
        sig: &Self::AggregateSignature,
    ) -> bool;
}
Expand description

A signature scheme used by validators.

Required Associated Types§

Source

type ValidatorId: ValidatorId

Source

type Signature: Signature

Signature type.

Source

type AggregateSignature: Signature

Type representing an aggregate signature. This would presumably be a BLS signature, yet even with Schnorr signatures half-aggregation is possible. It could even be a threshold signature scheme, though that’s currently unexpected.

Source

type Signer: Signer<ValidatorId = Self::ValidatorId, Signature = Self::Signature>

Type representing a signer of this scheme.

Required Methods§

Source

fn verify( &self, validator: Self::ValidatorId, msg: &[u8], sig: &Self::Signature, ) -> bool

Verify a signature from the validator in question.

Source

fn aggregate(sigs: &[Self::Signature]) -> Self::AggregateSignature

Aggregate signatures.

Source

fn verify_aggregate( &self, signers: &[Self::ValidatorId], msg: &[u8], sig: &Self::AggregateSignature, ) -> bool

Verify an aggregate signature for the list of signers.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: SignatureScheme> SignatureScheme for Arc<S>

Source§

type ValidatorId = <S as SignatureScheme>::ValidatorId

Source§

type Signature = <S as SignatureScheme>::Signature

Source§

type AggregateSignature = <S as SignatureScheme>::AggregateSignature

Source§

type Signer = <S as SignatureScheme>::Signer

Source§

fn verify( &self, validator: Self::ValidatorId, msg: &[u8], sig: &Self::Signature, ) -> bool

Source§

fn aggregate(sigs: &[Self::Signature]) -> Self::AggregateSignature

Source§

fn verify_aggregate( &self, signers: &[Self::ValidatorId], msg: &[u8], sig: &Self::AggregateSignature, ) -> bool

Implementors§