Trait tor_checkable::ExternallySigned
source · 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§
Required Methods§
sourcefn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
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.
sourcefn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
Check the signature on this object
sourcefn dangerously_assume_wellsigned(self) -> T
fn dangerously_assume_wellsigned(self) -> T
Unwrap this object without checking any signatures on it.
Provided Methods§
sourcefn check_signature(self, k: &Self::Key) -> Result<T, Self::Error>
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.