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§
Required Methods§
Sourcefn is_well_signed(&self) -> Result<(), Self::Error>
fn is_well_signed(&self) -> Result<(), Self::Error>
Check the signature on this object
Sourcefn dangerously_assume_wellsigned(self) -> T
fn dangerously_assume_wellsigned(self) -> T
Return the underlying object without checking its signature.
Provided Methods§
Sourcefn check_signature(self) -> Result<T, Self::Error>
fn check_signature(self) -> Result<T, Self::Error>
Unwrap this object if the signature is valid
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.