Initializer
init(dataRepresentation:format:)
Creates a secp256k1 ECDH private key from a 32-byte raw scalar.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
init<D>(dataRepresentation data: D, format: P256K.Format = .compressed) throws where D : ContiguousBytes
Parameters
-
data
-
Exactly 32 bytes; must pass secp256k1_ec_seckey_verify.
-
format
-
The serialization format of the companion publicKey; defaults to .compressed.
Discussion
Throws
secp256k1Error.incorrectKeySize if data is not 32 bytes; secp256k1Error.underlyingCryptoError if the scalar is invalid.