pub trait ExternallySigned<T>: Sized {
    type Key: ?Sized;
    type KeyHint;
    type Error;

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

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

A cryptographically signed object that needs an external public key to validate it.

Required Associated Types§

source

type Key: ?Sized

The type of the public key object.

You can use a tuple or a vector here if the object is signed with multiple keys.

source

type KeyHint

A type that describes what keys are missing for this object.

source

type Error

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

Required Methods§

source

fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>

Check whether k is the right key for this object. If not, return an error describing what key would be right.

This function is allowed to return ‘true’ for a bad key, but never ‘false’ for a good key.

source

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

Check the signature on this object

source

fn dangerously_assume_wellsigned(self) -> T

Unwrap this object without checking any signatures on it.

Provided Methods§

source

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

Unwrap this object if it’s correctly signed by a provided key.

Object Safety§

This trait is not object safe.

Implementors§