Initializer
init()
Creates a random secp256k1 Schnorr private key by generating 32 cryptographically secure random bytes validated with secp256k1_ec_seckey_verify.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
init() throws
Discussion
The backing key always uses the uncompressed public key format internally, as required by secp256k1_keypair_create.
Throws
secp256k1Error.underlyingCryptoError if the generated bytes are not a valid secp256k1 private key (probability < 2⁻¹²⁸).