[#MuSig2SecNonce]
= MuSig2SecNonce
:mrdocs:

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

== Synopsis

Declared in `&lt;musig&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class MuSig2SecNonce;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:MuSig2SecNonce/2constructor-01.adoc[`MuSig2SecNonce`]         [.small]#[constructor]#
| Constructors
| xref:MuSig2SecNonce/2destructor.adoc[`&#126;MuSig2SecNonce`] [.small]#[destructor]#
| Destroy the holder and securely release the secret nonce&period;
| xref:MuSig2SecNonce/operator_assign-04.adoc[`operator&equals;`] 
| Assignment operators
| xref:MuSig2SecNonce/Get.adoc[`Get`] 
| Get a pointer to the underlying libsecp256k1 secret nonce object&period;
| xref:MuSig2SecNonce/Invalidate.adoc[`Invalidate`] 
| Clear the secret nonce so it can no longer be used&period;
| xref:MuSig2SecNonce/IsValid.adoc[`IsValid`] 
| Check whether this holder currently owns a usable secret nonce&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CreateMuSig2Nonce.adoc[`CreateMuSig2Nonce`]
| Generate a MuSig2 public nonce for a signing session and store the matching secret nonce&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
