diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e0fece0d..ddf8aafe 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -5,6 +5,7 @@ on: branches: [ main ] pull_request: branches: [ main ] + workflow_dispatch: # allow manually-triggered runs jobs: build: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 260044f1..458afb5a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -5,6 +5,7 @@ on: branches: [ main ] pull_request: branches: [ main ] + workflow_dispatch: # allow manually-triggered runs jobs: build: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d2a57116..f3efa334 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -5,6 +5,7 @@ on: branches: [ main ] pull_request: branches: [ main ] + workflow_dispatch: # allow manually-triggered runs jobs: build: diff --git a/Package.swift b/Package.swift index 06d9ed47..86aec4e4 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,9 @@ let package = Package( ) ], targets: [ - .target(name: "CryptoSwift", resources: [.copy("PrivacyInfo.xcprivacy")]), + .target(name: "CryptoSwiftResources", resources: [ Resource.copy("PrivacyInfo.xcprivacy") ]), + .target(name: "CryptoSwift", + dependencies: [ .target(name: "CryptoSwiftResources", condition: .when(platforms: [ .iOS, .macOS, .tvOS, .watchOS, .macCatalyst, .visionOS ])) ]), .testTarget(name: "CryptoSwiftTests", dependencies: ["CryptoSwift"]) ], swiftLanguageVersions: [.v5] diff --git a/Sources/CryptoSwift/AEAD/AEADXChaCha20Poly1305.swift b/Sources/CryptoSwift/AEAD/AEADXChaCha20Poly1305.swift index 7204baf7..1d9b23f9 100644 --- a/Sources/CryptoSwift/AEAD/AEADXChaCha20Poly1305.swift +++ b/Sources/CryptoSwift/AEAD/AEADXChaCha20Poly1305.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif /// This class implements the XChaCha20-Poly1305 Authenticated Encryption with /// Associated Data (AEAD_XCHACHA20_POLY1305) construction, providing both encryption and authentication. diff --git a/Sources/CryptoSwift/ASN1/ASN1.swift b/Sources/CryptoSwift/ASN1/ASN1.swift index a865ddd7..fd6c61dc 100644 --- a/Sources/CryptoSwift/ASN1/ASN1.swift +++ b/Sources/CryptoSwift/ASN1/ASN1.swift @@ -14,7 +14,11 @@ // // ASN1 Code inspired by Asn1Parser.swift from SwiftyRSA +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif /// A Partial ASN.1 (Abstract Syntax Notation 1) Encoder & Decoder Implementation. /// diff --git a/Sources/CryptoSwift/ASN1/ASN1Decoder.swift b/Sources/CryptoSwift/ASN1/ASN1Decoder.swift index dfcb2258..b48658db 100644 --- a/Sources/CryptoSwift/ASN1/ASN1Decoder.swift +++ b/Sources/CryptoSwift/ASN1/ASN1Decoder.swift @@ -14,7 +14,11 @@ // // ASN1 Code inspired by Asn1Parser.swift from SwiftyRSA +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension ASN1 { /// A simple ASN1 parser that will recursively iterate over a root node and return a Node tree. diff --git a/Sources/CryptoSwift/ASN1/ASN1Encoder.swift b/Sources/CryptoSwift/ASN1/ASN1Encoder.swift index 8c2475e6..e5e038e5 100644 --- a/Sources/CryptoSwift/ASN1/ASN1Encoder.swift +++ b/Sources/CryptoSwift/ASN1/ASN1Encoder.swift @@ -14,7 +14,11 @@ // // ASN1 Code inspired by Asn1Parser.swift from SwiftyRSA +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension ASN1 { enum Encoder { diff --git a/Sources/CryptoSwift/ASN1/ASN1Scanner.swift b/Sources/CryptoSwift/ASN1/ASN1Scanner.swift index 886354a4..095b975a 100644 --- a/Sources/CryptoSwift/ASN1/ASN1Scanner.swift +++ b/Sources/CryptoSwift/ASN1/ASN1Scanner.swift @@ -14,7 +14,11 @@ // // ASN1 Scanner code is from Asn1Parser.swift from SwiftyRSA +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension ASN1 { /// Simple data scanner that consumes bytes from a raw data and keeps an updated position. diff --git a/Sources/CryptoSwift/CS_BigInt/Comparable.swift b/Sources/CryptoSwift/CS_BigInt/Comparable.swift index 86b79ea4..2d901948 100644 --- a/Sources/CryptoSwift/CS_BigInt/Comparable.swift +++ b/Sources/CryptoSwift/CS_BigInt/Comparable.swift @@ -6,7 +6,11 @@ // Copyright © 2016-2017 Károly Lőrentey. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension CS.BigUInt: Comparable { //MARK: Comparison diff --git a/Sources/CryptoSwift/CS_BigInt/DataConversion.swift b/Sources/CryptoSwift/CS_BigInt/DataConversion.swift index c1d8d958..ec706c70 100644 --- a/Sources/CryptoSwift/CS_BigInt/DataConversion.swift +++ b/Sources/CryptoSwift/CS_BigInt/DataConversion.swift @@ -6,7 +6,11 @@ // Copyright © 2016-2017 Károly Lőrentey. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension CS.BigUInt { //MARK: NSData Conversion diff --git a/Sources/CryptoSwift/Foundation/AES+Foundation.swift b/Sources/CryptoSwift/Foundation/AES+Foundation.swift index 6654fdee..d2d73714 100644 --- a/Sources/CryptoSwift/Foundation/AES+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/AES+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension AES { /// Initialize with CBC block mode. diff --git a/Sources/CryptoSwift/Foundation/Array+Foundation.swift b/Sources/CryptoSwift/Foundation/Array+Foundation.swift index c979dfa6..c4a4221a 100644 --- a/Sources/CryptoSwift/Foundation/Array+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/Array+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif public extension Array where Element == UInt8 { func toBase64(options: Data.Base64EncodingOptions = []) -> String { diff --git a/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift b/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift index c15f414c..531568bc 100644 --- a/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension Blowfish { /// Initialize with CBC block mode. diff --git a/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift b/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift index 973477d6..006c9e02 100644 --- a/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension ChaCha20 { public convenience init(key: String, iv: String) throws { diff --git a/Sources/CryptoSwift/Foundation/Data+Extension.swift b/Sources/CryptoSwift/Foundation/Data+Extension.swift index a9677dd4..98fa34a6 100644 --- a/Sources/CryptoSwift/Foundation/Data+Extension.swift +++ b/Sources/CryptoSwift/Foundation/Data+Extension.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension Data { /// Two octet checksum as defined in RFC-4880. Sum of all octets, mod 65536 diff --git a/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift b/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift index a41ba1bb..5dc7a57a 100644 --- a/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension HMAC { public convenience init(key: String, variant: HMAC.Variant = .md5) throws { diff --git a/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift b/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift index ce066fda..9cd691f2 100644 --- a/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension Rabbit { public convenience init(key: String) throws { diff --git a/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift b/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift index 89371f58..d53d30a8 100644 --- a/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift +++ b/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension String { /// Return Base64 back to String diff --git a/Sources/CryptoSwift/Foundation/Utils+Foundation.swift b/Sources/CryptoSwift/Foundation/Utils+Foundation.swift index 8ed7b841..618934e9 100644 --- a/Sources/CryptoSwift/Foundation/Utils+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/Utils+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif func perf(_ text: String, closure: () -> Void) { let measurementStart = Date() diff --git a/Sources/CryptoSwift/Foundation/XChaCha20+Foundation.swift b/Sources/CryptoSwift/Foundation/XChaCha20+Foundation.swift index b9f052e9..b297c8e4 100644 --- a/Sources/CryptoSwift/Foundation/XChaCha20+Foundation.swift +++ b/Sources/CryptoSwift/Foundation/XChaCha20+Foundation.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif extension XChaCha20 { /// Convenience initializer that creates an XChaCha20 instance with the given key and IV diff --git a/Sources/CryptoSwift/ISO10126Padding.swift b/Sources/CryptoSwift/ISO10126Padding.swift index 8aebd114..3187a501 100644 --- a/Sources/CryptoSwift/ISO10126Padding.swift +++ b/Sources/CryptoSwift/ISO10126Padding.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif /// Padding with random bytes, ending with the number of added bytes. /// Read the [Wikipedia](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO_10126) diff --git a/Sources/CryptoSwift/ISO78164Padding.swift b/Sources/CryptoSwift/ISO78164Padding.swift index e929f726..c01b4749 100644 --- a/Sources/CryptoSwift/ISO78164Padding.swift +++ b/Sources/CryptoSwift/ISO78164Padding.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif // First byte is 0x80, rest is zero padding // http://www.crypto-it.net/eng/theory/padding.html diff --git a/Sources/CryptoSwift/PEM/DER.swift b/Sources/CryptoSwift/PEM/DER.swift index 54545a35..1316f329 100644 --- a/Sources/CryptoSwift/PEM/DER.swift +++ b/Sources/CryptoSwift/PEM/DER.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif /// Conform to this protocol if your type can both be instantiated and expressed as an ASN1 DER representation. internal protocol DERCodable: DERDecodable, DEREncodable { } diff --git a/Sources/CryptoSwift/RSA/RSA+Cipher.swift b/Sources/CryptoSwift/RSA/RSA+Cipher.swift index e74132f9..1a465653 100644 --- a/Sources/CryptoSwift/RSA/RSA+Cipher.swift +++ b/Sources/CryptoSwift/RSA/RSA+Cipher.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif // MARK: Cipher diff --git a/Sources/CryptoSwift/RSA/RSA+Signature.swift b/Sources/CryptoSwift/RSA/RSA+Signature.swift index 7c643df8..a9e7739c 100644 --- a/Sources/CryptoSwift/RSA/RSA+Signature.swift +++ b/Sources/CryptoSwift/RSA/RSA+Signature.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif // MARK: Signatures & Verification diff --git a/Sources/CryptoSwift/RSA/RSA.swift b/Sources/CryptoSwift/RSA/RSA.swift index 749f1d08..8f767e61 100644 --- a/Sources/CryptoSwift/RSA/RSA.swift +++ b/Sources/CryptoSwift/RSA/RSA.swift @@ -14,7 +14,11 @@ // // Foundation is required for `Data` to be found +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif // Note: The `BigUInt` struct was copied from: // https://github.com/attaswift/BigInt diff --git a/Sources/CryptoSwift/String+Extension.swift b/Sources/CryptoSwift/String+Extension.swift index 635f04e8..a9770ec5 100644 --- a/Sources/CryptoSwift/String+Extension.swift +++ b/Sources/CryptoSwift/String+Extension.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif /** String extension */ extension String { diff --git a/Sources/CryptoSwift/UInt128.swift b/Sources/CryptoSwift/UInt128.swift index 8bbcbf18..b0277812 100644 --- a/Sources/CryptoSwift/UInt128.swift +++ b/Sources/CryptoSwift/UInt128.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif struct UInt128: Equatable, ExpressibleByIntegerLiteral { let i: (a: UInt64, b: UInt64) diff --git a/Sources/CryptoSwiftResources/Empty.swift b/Sources/CryptoSwiftResources/Empty.swift new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Sources/CryptoSwiftResources/Empty.swift @@ -0,0 +1 @@ + diff --git a/Sources/CryptoSwift/PrivacyInfo.xcprivacy b/Sources/CryptoSwiftResources/PrivacyInfo.xcprivacy similarity index 100% rename from Sources/CryptoSwift/PrivacyInfo.xcprivacy rename to Sources/CryptoSwiftResources/PrivacyInfo.xcprivacy diff --git a/Tests/CryptoSwiftTests/AESCCMTests.swift b/Tests/CryptoSwiftTests/AESCCMTests.swift index 1ee706a4..2fbd274d 100644 --- a/Tests/CryptoSwiftTests/AESCCMTests.swift +++ b/Tests/CryptoSwiftTests/AESCCMTests.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/AESOCBTests.swift b/Tests/CryptoSwiftTests/AESOCBTests.swift index 30a651cc..4122be76 100644 --- a/Tests/CryptoSwiftTests/AESOCBTests.swift +++ b/Tests/CryptoSwiftTests/AESOCBTests.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/AESTests.swift b/Tests/CryptoSwiftTests/AESTests.swift index 9f112015..8ae552dc 100644 --- a/Tests/CryptoSwiftTests/AESTests.swift +++ b/Tests/CryptoSwiftTests/AESTests.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/AESTestsPerf.swift b/Tests/CryptoSwiftTests/AESTestsPerf.swift index 0b782486..b368376c 100644 --- a/Tests/CryptoSwiftTests/AESTestsPerf.swift +++ b/Tests/CryptoSwiftTests/AESTestsPerf.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/Access.swift b/Tests/CryptoSwiftTests/Access.swift index 4eac75a7..aead8818 100644 --- a/Tests/CryptoSwiftTests/Access.swift +++ b/Tests/CryptoSwiftTests/Access.swift @@ -14,8 +14,13 @@ // // import without @testable to test public API -import CryptoSwift +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + +import CryptoSwift import XCTest class Access: XCTestCase { diff --git a/Tests/CryptoSwiftTests/ChaCha20Tests.swift b/Tests/CryptoSwiftTests/ChaCha20Tests.swift index d3989f72..ca44ab5b 100644 --- a/Tests/CryptoSwiftTests/ChaCha20Tests.swift +++ b/Tests/CryptoSwiftTests/ChaCha20Tests.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/ChaCha20TestsPerf.swift b/Tests/CryptoSwiftTests/ChaCha20TestsPerf.swift index d25e8c52..c11e41a7 100644 --- a/Tests/CryptoSwiftTests/ChaCha20TestsPerf.swift +++ b/Tests/CryptoSwiftTests/ChaCha20TestsPerf.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/DigestTests.swift b/Tests/CryptoSwiftTests/DigestTests.swift index c4587d85..932c3dff 100644 --- a/Tests/CryptoSwiftTests/DigestTests.swift +++ b/Tests/CryptoSwiftTests/DigestTests.swift @@ -16,7 +16,12 @@ // http://www.di-mgt.com.au/sha_testvectors.html (http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf) // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/DigestTestsPerf.swift b/Tests/CryptoSwiftTests/DigestTestsPerf.swift index 3d858a26..f28a017b 100644 --- a/Tests/CryptoSwiftTests/DigestTestsPerf.swift +++ b/Tests/CryptoSwiftTests/DigestTestsPerf.swift @@ -16,7 +16,12 @@ // http://www.di-mgt.com.au/sha_testvectors.html (http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf) // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/Error+Extension.swift b/Tests/CryptoSwiftTests/Error+Extension.swift index ac129e8f..56882259 100644 --- a/Tests/CryptoSwiftTests/Error+Extension.swift +++ b/Tests/CryptoSwiftTests/Error+Extension.swift @@ -13,7 +13,11 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif #if !_runtime(_ObjC) diff --git a/Tests/CryptoSwiftTests/ExtensionsTest.swift b/Tests/CryptoSwiftTests/ExtensionsTest.swift index df712a67..2e37cd7c 100644 --- a/Tests/CryptoSwiftTests/ExtensionsTest.swift +++ b/Tests/CryptoSwiftTests/ExtensionsTest.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/ExtensionsTestPerf.swift b/Tests/CryptoSwiftTests/ExtensionsTestPerf.swift index 10d24079..6382e732 100644 --- a/Tests/CryptoSwiftTests/ExtensionsTestPerf.swift +++ b/Tests/CryptoSwiftTests/ExtensionsTestPerf.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/Poly1305Tests.swift b/Tests/CryptoSwiftTests/Poly1305Tests.swift index 2777b15e..5d1c216f 100644 --- a/Tests/CryptoSwiftTests/Poly1305Tests.swift +++ b/Tests/CryptoSwiftTests/Poly1305Tests.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/RSASecKeyTests.swift b/Tests/CryptoSwiftTests/RSASecKeyTests.swift index 50b6fa7c..551f3a56 100644 --- a/Tests/CryptoSwiftTests/RSASecKeyTests.swift +++ b/Tests/CryptoSwiftTests/RSASecKeyTests.swift @@ -493,7 +493,7 @@ ) """ - private func initSecKey(rawRepresentation unsafe: Data) throws -> SecKey { + private func initSecKey(rawRepresentation `unsafe`: Data) throws -> SecKey { let attributes: [String: Any] = [ kSecAttrKeyType as String: kSecAttrKeyTypeRSA, kSecAttrKeyClass as String: kSecAttrKeyClassPrivate, @@ -502,7 +502,7 @@ ] var error: Unmanaged? - guard let secKey = SecKeyCreateWithData(unsafe as CFData, attributes as CFDictionary, &error) else { + guard let secKey = SecKeyCreateWithData(`unsafe` as CFData, attributes as CFDictionary, &error) else { throw NSError(domain: "Error constructing SecKey from raw key data: \(error.debugDescription)", code: 0, userInfo: nil) } diff --git a/Tests/CryptoSwiftTests/RSATests.swift b/Tests/CryptoSwiftTests/RSATests.swift index 82477e67..cbfbc363 100644 --- a/Tests/CryptoSwiftTests/RSATests.swift +++ b/Tests/CryptoSwiftTests/RSATests.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/SHATestsPerf.swift b/Tests/CryptoSwiftTests/SHATestsPerf.swift index c1f52aa2..8715cd66 100644 --- a/Tests/CryptoSwiftTests/SHATestsPerf.swift +++ b/Tests/CryptoSwiftTests/SHATestsPerf.swift @@ -13,7 +13,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift diff --git a/Tests/CryptoSwiftTests/SignatureVerificationTests.swift b/Tests/CryptoSwiftTests/SignatureVerificationTests.swift index 159184aa..1e3232f8 100644 --- a/Tests/CryptoSwiftTests/SignatureVerificationTests.swift +++ b/Tests/CryptoSwiftTests/SignatureVerificationTests.swift @@ -12,7 +12,12 @@ // - This notice may not be removed or altered from any source or binary distribution. // +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation +#endif + import XCTest @testable import CryptoSwift