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
impl SecretNonce
Sourcepub fn as_ptr(&self) -> *const MusigSecNonce
pub fn as_ptr(&self) -> *const MusigSecNonce
Gets a const pointer to the inner SecretNonce.
Sourcepub fn as_mut_ptr(&mut self) -> *mut MusigSecNonce
pub fn as_mut_ptr(&mut self) -> *mut MusigSecNonce
Gets a mut pointer to the inner SecretNonce.
Sourcepub fn dangerous_into_bytes(self) -> [u8; 132]
pub fn dangerous_into_bytes(self) -> [u8; 132]
Returns a copy of the internal array. See warnings below 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 SecretNonce::dangerous_from_bytes from the same libsecp256k1
version, and the same platform.
Sourcepub fn dangerous_from_bytes(array: [u8; 132]) -> SecretNonce
pub fn dangerous_from_bytes(array: [u8; 132]) -> SecretNonce
Creates a new SecretNonce from a 32 byte array.
Refer to the warnings on SecretNonce::dangerous_into_bytes for more details.
Sourcepub fn non_secure_erase(&mut self)
pub fn non_secure_erase(&mut self)
Attempts to erase the secret within the underlying array.
Note, however, that the compiler is allowed to freely copy or move the contents
of this array to other places in memory. Preventing this behavior is very subtle.
For more discussion on this, please see the documentation of the
zeroize crate.