w3f_bls

Trait Signed

Source
pub trait Signed: Sized {
    type E: EngineBLS;
    type M: Borrow<Message>;
    type PKG: Borrow<PublicKey<Self::E>>;
    type PKnM: Iterator<Item = (Self::M, Self::PKG)> + ExactSizeIterator;

    // Required methods
    fn signature(&self) -> Signature<Self::E>;
    fn messages_and_publickeys(self) -> Self::PKnM;

    // Provided method
    fn verify(self) -> bool { ... }
}
Expand description

Representation of an aggregated BLS signature.

We implement this trait only for borrows of appropriate structs because otherwise we’d need extensive lifetime plumbing here, due to the absence of assocaited type constructers (ATCs). We shall make messages_and_publickeys take &sefl and remove these limitations in the future once ATCs stabalize, thus removing PKG. See Rust RFC 1598 We shall eventually remove MnPK entirely whenever -> impl Trait in traits gets stabalized. See [Rust RFCs 1522, 1951, and 2071](https://github.com/rust-lang/rust/issues/34511

Required Associated Types§

Source

type E: EngineBLS

Source

type M: Borrow<Message>

Source

type PKG: Borrow<PublicKey<Self::E>>

Source

type PKnM: Iterator<Item = (Self::M, Self::PKG)> + ExactSizeIterator

Iterator over, messages and public key reference pairs.

Required Methods§

Source

fn signature(&self) -> Signature<Self::E>

Return the aggregated signature

Source

fn messages_and_publickeys(self) -> Self::PKnM

Returns an iterator over messages and public key reference for pairings, often only partially aggregated.

Provided Methods§

Source

fn verify(self) -> bool

Appropriate BLS signature verification for the Self type.

We use verify_simple as a default implementation because it supports unstable self.messages_and_publickeys() securely by calling it only once, and does not expect pulic key points to be normalized, but this should usually be replaced by more optimized variants.

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§