SecretNonce

Struct SecretNonce 

Source
pub struct SecretNonce(/* private fields */);
Expand description

Musig Secret Nonce.

A signer who is online throughout the whole process and can keep this structure in memory can use the provided API functions for a safe standard workflow.

This structure does not implement Copy or Clone; after construction the only thing that can or should be done with this nonce is to call Session::partial_sign, which will take ownership. This is to prevent accidental reuse of the nonce.

See the warnings on Self::dangerous_into_bytes for more information about the risks of non-standard workflows.

Implementations§

Source§

impl SecretNonce

Source

pub fn as_ptr(&self) -> *const MusigSecNonce

Get a const pointer to the inner KeyAggCache

Source

pub fn as_mut_ptr(&mut self) -> *mut MusigSecNonce

Get a mut pointer to the inner KeyAggCache

Source

pub fn dangerous_into_bytes(self) -> [u8; 132]

Function to return a copy of the internal array. See WARNING before using this function.

§Warning:

Storing and re-creating this structure may lead to nonce reuse, which will leak your secret key in two signing sessions, even if neither session is completed. These functions should be avoided if possible and used with care.

See https://blockstream.com/2019/02/18/musig-a-new-multisignature-standard/ for more details about these risks.

§Warning:

The underlying library, libsecp256k1, does not guarantee the byte format will be consistent across versions or platforms. Special care should be taken to ensure the returned bytes are only ever passed to dangerous_from_bytes from the same libsecp256k1 version, and the same platform.

Source

pub fn dangerous_from_bytes(array: [u8; 132]) -> SecretNonce

Function to create a new SecretNonce from a 32 byte array.

Refer to the warnings on SecretNonce::dangerous_into_bytes for more details.

Trait Implementations§

Source§

impl CPtr for SecretNonce

Source§

impl Debug for SecretNonce

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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