pub trait Signer {
// Required methods
fn try_pubkey(&self) -> Result<Pubkey, SignerError>;
fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>;
fn is_interactive(&self) -> bool;
// Provided methods
fn pubkey(&self) -> Pubkey { ... }
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§
sourcefn try_pubkey(&self) -> Result<Pubkey, SignerError>
fn try_pubkey(&self) -> Result<Pubkey, SignerError>
Fallibly gets the implementor’s public key
sourcefn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>
fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>
Fallibly produces an Ed25519 signature over the provided message
bytes.
sourcefn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
Whether the implementation requires user interaction to sign
Provided Methods§
sourcefn pubkey(&self) -> Pubkey
fn pubkey(&self) -> Pubkey
Infallibly gets the implementor’s public key. Returns the all-zeros
Pubkey
if the implementor has none.
sourcefn sign_message(&self, message: &[u8]) -> Signature
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.