Structure
P256K.MuSig.SessionSecretRand
The 32 bytes of secret, uniformly random input (session_secrand32) that secp256k1_musig_nonce_gen mixes into every MuSig2 nonce derivation.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
struct SessionSecretRand
Overview
Modeled as ~Copyable so a value cannot be duplicated and must be consumed by generate(sessionSecretRand:secretKey:publicKey:msg32:extraInput32:) — reusing this input produces identical nonces and leaks the secret signing key. The randomness lives in SecureBytes, the same auto-zeroing storage used for private keys and shared secrets: secp256k1_musig_nonce_gen zeroes this value’s own buffer in place on a successful call, and the SecureBytes backing runs memset_s when the value is released — covering never-consumed values and calls where upstream returns failure (it only guarantees zeroing on success).
Like libsecp256k1’s own best-effort model, this does not cover copies outside the value’s control: the caller’s source array passed to init(bytes:) (per that initializer’s warning) and any bytes the compiler may spill to the stack or the OS may page out — OS-level mlock protection is out of scope.
Topics