1414#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
1515@_exported import CryptoKit
1616#else
17- #if canImport(FoundationEssentials)
18- public import FoundationEssentials
19- #else
20- public import Foundation
21- #endif
22-
23- #if _runtime(_ObjC) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
24- @_exported import CryptoKit
25- #else
2617
27- #if CRYPTOKIT_NO_ACCESS_TO_FOUNDATION
28- import SwiftSystem
29- #else
3018#if canImport(FoundationEssentials)
3119import FoundationEssentials
3220#else
3321import Foundation
3422#endif
35- #endif
3623
3724#if (!CRYPTO_IN_SWIFTPM_FORCE_BUILD_API) || CRYPTOKIT_NO_ACCESS_TO_FOUNDATION
3825@available ( macOS 10 . 15 , iOS 13 , watchOS 6 , tvOS 13 , macCatalyst 13 , visionOS 1 . 0 , * )
@@ -61,8 +48,8 @@ extension XWingMLKEM768X25519 {
6148 self . impl = impl
6249 }
6350
64- public init < D: ContiguousBytes > ( dataRepresentation : D ) throws {
65- self . impl = try . init( dataRepresentation : dataRepresentation )
51+ public init < D: ContiguousBytes > ( rawRepresentation : D ) throws {
52+ self . impl = try . init( rawRepresentation : rawRepresentation )
6653 }
6754
6855 public var rawRepresentation : Data {
@@ -96,20 +83,10 @@ extension XWingMLKEM768X25519 {
9683 self . impl = impl
9784 }
9885
99- public init < D: ContiguousBytes > ( bytes: D ) throws {
100- self . impl = try . init( bytes: bytes)
101- }
102-
10386 internal init < D: DataProtocol > ( seedRepresentation: D , publicKeyHash: SHA3_256Digest ? ) throws {
10487 self . impl = try . init( seedRepresentation: seedRepresentation, publicKeyHash: publicKeyHash)
10588 }
10689
107- public var dataRepresentation : Data {
108- get {
109- self . impl. dataRepresentation
110- }
111- }
112-
11390 public static func generate( ) throws -> XWingMLKEM768X25519 . PrivateKey {
11491 return try Self ( impl: XWingPrivateKeyImpl . generate ( ) )
11592 }
@@ -133,17 +110,12 @@ extension XWingMLKEM768X25519.PrivateKey: HPKEKEMPrivateKeyGeneration {
133110 }
134111
135112 public init < D: DataProtocol > ( seedRepresentation: D , publicKey: XWingMLKEM768X25519 . PublicKey ? ) throws {
136- #if false
137113 var publicKeyHash : SHA3_256Digest ? = nil
138114 if publicKey != nil {
139115 publicKeyHash = SHA3_256 . hash ( data: publicKey!. rawRepresentation)
140116 }
141117
142118 self = try XWingMLKEM768X25519 . PrivateKey. init ( seedRepresentation: seedRepresentation, publicKeyHash: publicKeyHash)
143- #else
144- precondition ( publicKey == nil )
145- self = try XWingMLKEM768X25519 . PrivateKey. init ( seedRepresentation: seedRepresentation, publicKeyHash: nil )
146- #endif
147119 }
148120
149121 public init < D: DataProtocol > ( integrityCheckedRepresentation: D ) throws {
@@ -178,7 +150,7 @@ extension XWingMLKEM768X25519.PublicKey: HPKEKEMPublicKey {
178150 /// - Throws: ``CryptoKit/HPKE/Errors/inconsistentCiphersuiteAndKey`` if the key encapsulation mechanism requested is incompatible with this public key.
179151 public init < D> ( _ serialization: D , kem: HPKE . KEM ) throws where D: ContiguousBytes {
180152 try Self . validateCiphersuite ( kem)
181- try self . init ( dataRepresentation : serialization)
153+ try self . init ( rawRepresentation : serialization)
182154 }
183155
184156 /// Creates a serialized representation of the public key.
@@ -197,5 +169,4 @@ extension XWingMLKEM768X25519.PublicKey: HPKEKEMPublicKey {
197169 /// The type of the ephemeral private key associated with this public key.
198170 public typealias HPKEEphemeralPrivateKey = XWingMLKEM768X25519 . PrivateKey
199171}
200- #endif
201172#endif // Linux or !SwiftPM
0 commit comments