Signer

Trait Signer 

Source
pub trait Signer<H: Hashable> {
    // Required methods
    fn sign(&mut self, kp: &Keypair, input: &H, packed: bool) -> 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, packed: bool) -> 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])
  • packed - Controls nonce derivation method:
    • true: Use OCaml/TypeScript compatible nonce derivation with field packing
    • false: Use standard Rust nonce derivation
§Returns

A Signature over the input message.

§Compatibility

Use packed: true when compatibility with OCaml and TypeScript implementations is required. Use packed: false for standard Rust-only usage.

Note: The standard nonce derivation (packed: false) will be deprecated in future versions. Use packed: true for new code to ensure forward compatibility.

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.

Implementors§

Source§

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