pub trait Signable: Sized {
type SignedOutput;
// Required methods
fn unsigned_payload(&self) -> Result<Vec<u8>, Error>;
fn label(&self) -> &str;
// Provided method
fn sign(
self,
signer: &impl Signer,
) -> Result<Self::SignedOutput, SignatureError>
where Self::SignedOutput: SignedStruct<Self> { ... }
}
Expand description
The Signable
trait is implemented by all struct that are being signed.
The implementation has to provide the unsigned_payload
function.
Required Associated Types§
Sourcetype SignedOutput
type SignedOutput
The type of the object once it’s signed.
Required Methods§
Provided Methods§
Sourcefn sign(
self,
signer: &impl Signer,
) -> Result<Self::SignedOutput, SignatureError>where
Self::SignedOutput: SignedStruct<Self>,
fn sign(
self,
signer: &impl Signer,
) -> Result<Self::SignedOutput, SignatureError>where
Self::SignedOutput: SignedStruct<Self>,
Sign the payload with the given private_key
.
Returns a Signature
.
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.