referrerpolicy=no-referrer-when-downgrade
frame_system::offchain

Trait SignedPayload

Source
pub trait SignedPayload<T: SigningTypes>: Encode {
    // Required method
    fn public(&self) -> T::Public;

    // Provided methods
    fn sign<C: AppCrypto<T::Public, T::Signature>>(
        &self,
    ) -> Option<T::Signature> { ... }
    fn verify<C: AppCrypto<T::Public, T::Signature>>(
        &self,
        signature: T::Signature,
    ) -> bool { ... }
}
Expand description

Utility trait to be implemented on payloads that can be signed.

Required Methods§

Source

fn public(&self) -> T::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§

Source

fn sign<C: AppCrypto<T::Public, T::Signature>>(&self) -> Option<T::Signature>

Sign the payload using the implementor’s provided public key.

Returns Some(signature) if public key is supported.

Source

fn verify<C: AppCrypto<T::Public, T::Signature>>( &self, signature: T::Signature, ) -> bool

Verify signature against payload.

Returns a bool indicating whether the signature is valid or not.

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.

Implementors§

impl<T: SigningTypes> SignedPayload<T> for PricePayload<T::Public, BlockNumberFor<T>>