Skip to main content

Signer

Trait Signer 

Source
pub trait Signer {
    type Validator: Validator;
    type Signature: Signature;
    type SignFuture: Future<Output = Self::Signature>;

    // Required methods
    fn validator(&self) -> Self::Validator;
    fn sign(
        &self,
        message: impl IntoIterator<Item = impl AsRef<[u8]>>,
    ) -> Self::SignFuture;
}
Expand description

A signer for a validator.

Required Associated Types§

Source

type Validator: Validator

The type used to identify validators.

Source

type Signature: Signature

The type used to represent signatures.

Source

type SignFuture: Future<Output = Self::Signature>

The future yielded by Signer::sign.

This DOES NOT need to be cancel-safe.

Required Methods§

Source

fn validator(&self) -> Self::Validator

This validator’s ID.

This MUST be consistent and not change across multiple invocations.

Source

fn sign( &self, message: impl IntoIterator<Item = impl AsRef<[u8]>>, ) -> Self::SignFuture

Sign a signature as this validator.

The message is the concatenation of each byte slice yielded by the iterator.

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: ?Sized + Signer> Signer for &S

Source§

type Validator = <S as Signer>::Validator

Source§

type Signature = <S as Signer>::Signature

Source§

type SignFuture = <S as Signer>::SignFuture

Source§

fn validator(&self) -> Self::Validator

Source§

fn sign( &self, message: impl IntoIterator<Item = impl AsRef<[u8]>>, ) -> Self::SignFuture

Implementors§