Skip to main content

Signer

Trait Signer 

Source
pub trait Signer:
    Debug
    + Send
    + Sync {
    // Required methods
    fn sign(&self, data: &[u8]) -> Signature;
    fn public_key(&self) -> PublicKey<'_>;
}
Expand description

A Signer provides the ability to generate a Signature for provided payload data.

This abstraction decouples the caller from the underlying key type and storage.

Note that the key material used by a Signer instance MUST NOT change for the lifetime of the Signer instance.

Required Methods§

Source

fn sign(&self, data: &[u8]) -> Signature

Sign data with this private key.

Signatures are non-deterministic and rely on randomness on the host.

Source

fn public_key(&self) -> PublicKey<'_>

Obtain the PublicKey for this Signer.

Invariant: from the caller’s perspective, a single Signer instance always returns the same PublicKey (key material).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> Signer for Arc<T>
where T: Signer,

Source§

fn sign(&self, data: &[u8]) -> Signature

Source§

fn public_key(&self) -> PublicKey<'_>

Implementors§