Initializer
init(dataRepresentation:format:)
Creates a secp256k1 ECDH public key from serialized bytes.
- 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
-
Serialized public key bytes whose length must match format.length (33 for compressed, 65 for uncompressed).
-
format
-
The serialization format; defaults to .compressed (33 bytes).
Discussion
Throws
secp256k1Error.underlyingCryptoError if parsing via secp256k1_ec_pubkey_parse fails (invalid encoding or off-curve point).