MuSig2SecNonce encapsulates a secret nonce in use in a MuSig2 signing session. Since this nonce persists outside of libsecp256k1 signing code, we must handle its construction and destruction ourselves. The secret nonce must be kept a secret, otherwise the private key may be leaked. As such, it needs to be treated in the same way that CKeys are treated. So this class handles the secure allocation of the secp256k1_musig_secnonce object that libsecp256k1 uses, and only gives out references to this object to avoid any possibility of copies being made. Furthermore, objects of this class are not copyable to avoid nonce reuse.

Synopsis

Declared in <musig.h>

class MuSig2SecNonce;

Member Functions

Name

Description

MuSig2SecNonce [constructor]

Constructors

~MuSig2SecNonce [destructor]

Destroy the holder and securely release the secret nonce.

operator=

Assignment operators

Get

Get a pointer to the underlying libsecp256k1 secret nonce object.

Invalidate

Clear the secret nonce so it can no longer be used.

IsValid

Check whether this holder currently owns a usable secret nonce.

Non-Member Functions

Name

Description

CreateMuSig2Nonce

Generate a MuSig2 public nonce for a signing session and store the matching secret nonce.

Created with MrDocs