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§

source

type SignedOutput

The type of the object once it’s signed.

Required Methods§

source

fn unsigned_payload(&self) -> Result<Vec<u8>, Error>

Return the unsigned, serialized payload that should be signed.

source

fn label(&self) -> &str

Return the string label used for labeled signing.

Provided Methods§

source

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.

Implementors§