pub trait SignedPayload<T>: Encodewhere
T: SigningTypes,{
// Required method
fn public(&self) -> <T as SigningTypes>::Public;
// Provided methods
fn sign<C>(&self) -> Option<<T as SigningTypes>::Signature>
where C: AppCrypto<<T as SigningTypes>::Public, <T as SigningTypes>::Signature> { ... }
fn verify<C>(&self, signature: <T as SigningTypes>::Signature) -> bool
where C: AppCrypto<<T as SigningTypes>::Public, <T as SigningTypes>::Signature> { ... }
}
Expand description
Utility trait to be implemented on payloads that can be signed.
Required Methods§
fn public(&self) -> <T as SigningTypes>::Public
fn public(&self) -> <T as SigningTypes>::Public
Return a public key that is expected to have a matching key in the keystore, which should be used to sign the payload.
Provided Methods§
fn sign<C>(&self) -> Option<<T as SigningTypes>::Signature>
fn sign<C>(&self) -> Option<<T as SigningTypes>::Signature>
Sign the payload using the implementor’s provided public key.
Returns Some(signature)
if public key is supported.
fn verify<C>(&self, signature: <T as SigningTypes>::Signature) -> bool
fn verify<C>(&self, signature: <T as SigningTypes>::Signature) -> bool
Verify signature against payload.
Returns a bool indicating whether the signature is valid or not.
Object Safety§
This trait is not object safe.