Skip to main content

Signer

Trait Signer 

Source
pub trait Signer<H: Hashable> {
    // Required methods
    fn sign(
        &mut self,
        kp: &Keypair,
        input: &H,
        nonce_mode: NonceMode,
    ) -> Signature;
    fn verify(&mut self, sig: &Signature, pub_key: &PubKey, input: &H) -> bool;
}
Expand description

Interface for signed objects

Signer interface for signing [Hashable] inputs and verifying Signatures using Keypairs and PubKeys

Required Methods§

Source

fn sign(&mut self, kp: &Keypair, input: &H, nonce_mode: NonceMode) -> Signature

Sign input (see [Hashable]) using keypair kp and return the corresponding signature.

§Parameters
  • kp - The keypair to use for signing
  • input - The message to sign (must implement [Hashable])
  • nonce_mode - Controls nonce derivation method:
§Returns

A Signature over the input message.

Source

fn verify(&mut self, sig: &Signature, pub_key: &PubKey, input: &H) -> bool

Verify that the signature sig on input (see [Hashable]) is signed with the secret key corresponding to pub_key. Return true if the signature is valid and false otherwise.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<H: 'static + Hashable> Signer<H> for Schnorr<H>