Skip to main content

ExternalSigner

Struct ExternalSigner 

Source
pub struct ExternalSigner<F> { /* private fields */ }
Available on crate feature sign only.
Expand description

A signer backed by a secure element, HSM or any other external device.

The closure receives the SHA-256 digest and returns (r, s). The public key is supplied up front because the private key never leaves the device.

Implementations§

Source§

impl<F> ExternalSigner<F>
where F: Fn(&[u8; 32]) -> Option<(Vec<u8>, Vec<u8>)>,

Source

pub fn new(public_key: PublicKey, sign: F) -> Self

Wraps an external signing function.

Trait Implementations§

Source§

impl<F> Debug for ExternalSigner<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F> Signer for ExternalSigner<F>
where F: Fn(&[u8; 32]) -> Option<(Vec<u8>, Vec<u8>)>,

Source§

fn curve(&self) -> Curve

The curve this signer signs on.
Source§

fn public_key(&self) -> Result<PublicKey, BuildError>

The matching public key, used for the builder’s self-check. Read more
Source§

fn sign_prehash( &self, digest: &[u8; 32], ) -> Result<(Vec<u8>, Vec<u8>), BuildError>

Signs a 32-byte SHA-256 digest, returning (r, s) big-endian. Read more

Auto Trait Implementations§

§

impl<F> Forget for ExternalSigner<F>

§

impl<F> Freeze for ExternalSigner<F>
where F: Freeze,

§

impl<F> Move for ExternalSigner<F>

§

impl<F> RefUnwindSafe for ExternalSigner<F>
where F: RefUnwindSafe,

§

impl<F> Send for ExternalSigner<F>
where F: Send,

§

impl<F> Sync for ExternalSigner<F>
where F: Sync,

§

impl<F> Unpin for ExternalSigner<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for ExternalSigner<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for ExternalSigner<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.