Trait Signer

pub trait Signer {
    // Required methods
    fn try_pubkey(&self) -> Result<Address, SignerError>;
    fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>;
    fn is_interactive(&self) -> bool;

    // Provided methods
    fn pubkey(&self) -> Address { ... }
    fn sign_message(&self, message: &[u8]) -> Signature { ... }
}
Expand description

The Signer trait declares operations that all digital signature providers must support. It is the primary interface by which signers are specified in Transaction signing interfaces

Required Methods§

fn try_pubkey(&self) -> Result<Address, SignerError>

Fallibly gets the implementor’s public key

fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>

Fallibly produces an Ed25519 signature over the provided message bytes.

fn is_interactive(&self) -> bool

Whether the implementation requires user interaction to sign

Provided Methods§

fn pubkey(&self) -> Address

Infallibly gets the implementor’s public key. Returns the all-zeros Pubkey if the implementor has none.

fn sign_message(&self, message: &[u8]) -> Signature

Infallibly produces an Ed25519 signature over the provided message bytes. Returns the all-zeros Signature if signing is not possible.

Trait Implementations§

§

impl Debug for dyn Signer

§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl PartialEq for dyn Signer

§

fn eq(&self, other: &dyn Signer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for dyn Signer

Implementations on Foreign Types§

§

impl Signer for Keypair

§

fn pubkey(&self) -> Address

§

fn try_pubkey(&self) -> Result<Address, SignerError>

§

fn sign_message(&self, message: &[u8]) -> Signature

§

fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>

§

fn is_interactive(&self) -> bool

Implementors§

Source§

impl Signer for NoopSigner

§

impl Signer for NullSigner

§

impl<Container> Signer for Container
where Container: Deref<Target = impl Signer + ?Sized>,

This implements Signer for all ptr types - Box/Rc/Arc/&/&mut etc