Initializer
init(bytes:)
Creates session randomness from caller-supplied bytes, e.g. deterministic test vectors or an external entropy source such as a hardware RNG.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
init(bytes: [UInt8]) throws
Parameters
-
bytes
-
Exactly byteCount (32) bytes of secret uniform randomness.
Discussion
Warning
The bytes must be uniformly random and kept secret — even from co-signers. If a co-signer can predict them, they can recompute the secret nonce and extract the secret key from the partial signature. Each value is consumed by exactly one signing session. The source array is not zeroed — discard or zero it yourself after constructing this value.
Throws
secp256k1Error.incorrectParameterSize if bytes.count is not exactly 32.