mpc_driver::signers::schnorr

Struct SchnorrSigner

Source
pub struct SchnorrSigner<'a> { /* private fields */ }
Available on crate feature schnorr only.
Expand description

Create a signer for Taproot BIP-340 Schnorr signatures.

Implementations§

Source§

impl<'a> SchnorrSigner<'a>

Source

pub fn new(signing_key: Cow<'a, SigningKey>) -> Self

Create a new signer.

Source

pub fn from_slice(signing_key: &[u8]) -> Result<SigningKey>

Initialize a signing key from a byte slice.

Source

pub fn random() -> SigningKey

Generate a random private signing key.

Source

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

Sign a message.

Source

pub fn sign_prehash(&self, prehash: &[u8]) -> Result<Signature>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong.

Source

pub fn sign_raw( &self, msg_digest: &[u8], aux_rand: &[u8; 32], ) -> Result<Signature>

Compute Schnorr signature.

§⚠️ Warning

This is a low-level interface intended only for unusual use cases involving signing pre-hashed messages.

Source

pub fn verifying_key(&self) -> &VerifyingKey

Verifying key for this signer.

Source

pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<()>

Verify a Schnorr signaature.

Source

pub fn verify_raw(&self, message: &[u8], signature: &Signature) -> Result<()>

Verify a Schnorr signaature.

§⚠️ Warning

This is a low-level interface intended only for unusual use cases involving verifying pre-hashed messages, or “raw” messages where the message is not hashed at all prior to being used to generate the Schnorr signature.

Auto Trait Implementations§

§

impl<'a> Freeze for SchnorrSigner<'a>

§

impl<'a> RefUnwindSafe for SchnorrSigner<'a>

§

impl<'a> Send for SchnorrSigner<'a>

§

impl<'a> Sync for SchnorrSigner<'a>

§

impl<'a> Unpin for SchnorrSigner<'a>

§

impl<'a> UnwindSafe for SchnorrSigner<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V