pub trait SelfSigned<T>: Sized {
    type Error;

    // Required methods
    fn is_well_signed(&self) -> Result<(), Self::Error>;
    fn dangerously_assume_wellsigned(self) -> T;

    // Provided method
    fn check_signature(self) -> Result<T, Self::Error> { ... }
}
Expand description

A cryptographically signed object that can be validated without additional public keys.

It’s better to wrap things in a SelfSigned than to give them an is_valid() method, so that you can make sure that nobody uses the object before checking it. It’s better to wrap things in a SelfSigned than to check them immediately, since you might want to defer the signature checking operation to another thread.

Required Associated Types§

source

type Error

An error type that’s returned when the object is not well-signed.

Required Methods§

source

fn is_well_signed(&self) -> Result<(), Self::Error>

Check the signature on this object

source

fn dangerously_assume_wellsigned(self) -> T

Return the underlying object without checking its signature.

Provided Methods§

source

fn check_signature(self) -> Result<T, Self::Error>

Unwrap this object if the signature is valid

Object Safety§

This trait is not object safe.

Implementors§