Initializer
init(format:)
Creates a random secp256k1 private key for signing by generating 32 cryptographically secure random bytes and validating them with secp256k1_ec_seckey_verify.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
init(format: P256K.Format = .compressed) throws
Parameters
-
format
-
The serialization format of the companion publicKey; defaults to .compressed.
Discussion
Throws
secp256k1Error.underlyingCryptoError if the generated bytes do not form a valid secp256k1 private key (probability < 2⁻¹²⁸).