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§
Sourcefn sign(&mut self, kp: &Keypair, input: &H, packed: bool) -> Signature
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 signinginput- The message to sign (must implement [Hashable])packed- Controls nonce derivation method:true: Use OCaml/TypeScript compatible nonce derivation with field packingfalse: 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.