From 1265cf8133a5a649896ce5031bcb35d19695be7a Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Sun, 18 Jun 2023 10:43:10 +0100 Subject: [PATCH] Remove SotoCrypto (#546) * Remove SotoCrypto * Remove @available/format --- Package.swift | 26 ++-- .../AWSClient+EndpointDiscovery+async.swift | 1 - .../SotoCore/AWSClient+Paginate+async.swift | 1 - Sources/SotoCore/AWSClient+Paginate.swift | 6 +- Sources/SotoCore/AWSClient+async.swift | 1 - Sources/SotoCore/AWSClient.swift | 4 +- Sources/SotoCore/AWSService+async.swift | 1 - .../SotoCore/AWSShapes/Payload+async.swift | 1 - Sources/SotoCore/AWSShapes/Payload.swift | 2 +- .../FixedSizeByteBufferAsyncSequence.swift | 3 - .../Concurrency/Sequence+concurrentMap.swift | 1 - .../ConfigFileCredentialProvider.swift | 2 +- .../Credential/CredentialProvider+async.swift | 4 +- .../DeferredCredentialProvider.swift | 4 +- .../CodableProperties/CollectionCoders.swift | 2 +- .../CodableProperties/EC2ArrayCoder.swift | 2 +- Sources/SotoCore/HTTP/S3StreamReader.swift | 2 +- .../SotoCore/HTTP/StreamWriter+write.swift | 2 +- Sources/SotoCore/Message/AWSRequest.swift | 10 +- .../Message/Middleware/S3Middleware.swift | 2 +- .../Middleware/TreeHashMiddleware.swift | 2 +- .../Waiters/AWSClient+Waiter+async.swift | 1 - Sources/SotoCore/Waiters/Matcher.swift | 4 +- Sources/SotoCrypto/ByteArray.swift | 40 ------ Sources/SotoCrypto/Digest.swift | 29 ----- Sources/SotoCrypto/HMAC.swift | 80 ------------ Sources/SotoCrypto/HashFunction.swift | 81 ------------ Sources/SotoCrypto/Insecure.swift | 21 ---- Sources/SotoCrypto/MD5.swift | 55 -------- Sources/SotoCrypto/SHA1.swift | 55 -------- Sources/SotoCrypto/SHA2.swift | 117 ------------------ Sources/SotoCrypto/SymmetricKey.swift | 41 ------ Sources/SotoCrypto/exports.swift | 19 --- Sources/SotoSignerV4/signer.swift | 2 +- Sources/SotoTestUtils/TestServer.swift | 8 +- Sources/SotoXML/XMLEncoder.swift | 14 +-- .../Concurrency/AsyncSequenceTests.swift | 2 - Tests/SotoCoreTests/Concurrency/Count.swift | 1 - .../Sequence+concurrentMapTests.swift | 1 - .../EndpointDiscoveryTests.swift | 1 - Tests/SotoCoreTests/PaginateTests.swift | 1 - 41 files changed, 43 insertions(+), 609 deletions(-) delete mode 100644 Sources/SotoCrypto/ByteArray.swift delete mode 100644 Sources/SotoCrypto/Digest.swift delete mode 100644 Sources/SotoCrypto/HMAC.swift delete mode 100644 Sources/SotoCrypto/HashFunction.swift delete mode 100644 Sources/SotoCrypto/Insecure.swift delete mode 100644 Sources/SotoCrypto/MD5.swift delete mode 100644 Sources/SotoCrypto/SHA1.swift delete mode 100644 Sources/SotoCrypto/SHA2.swift delete mode 100644 Sources/SotoCrypto/SymmetricKey.swift delete mode 100644 Sources/SotoCrypto/exports.swift diff --git a/Package.swift b/Package.swift index 0da76e2b4..fd7a3ddac 100644 --- a/Package.swift +++ b/Package.swift @@ -17,6 +17,12 @@ import PackageDescription let package = Package( name: "soto-core", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6), + ], products: [ .library(name: "SotoCore", targets: ["SotoCore"]), .library(name: "SotoTestUtils", targets: ["SotoTestUtils"]), @@ -24,6 +30,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"), + .package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.4.0"), .package(url: "https://github.com/apple/swift-metrics.git", "1.0.0"..<"3.0.0"), .package(url: "https://github.com/apple/swift-nio.git", from: "2.42.0"), @@ -52,9 +59,8 @@ let package = Package( .product(name: "JMESPath", package: "jmespath.swift"), ] ), - .target(name: "SotoCrypto", dependencies: []), .target(name: "SotoSignerV4", dependencies: [ - .byName(name: "SotoCrypto"), + .product(name: "Crypto", package: "swift-crypto"), .product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOHTTP1", package: "swift-nio"), ]), @@ -74,9 +80,6 @@ let package = Package( .target(name: "CSotoExpat", dependencies: []), .target(name: "INIParser", dependencies: []), - .testTarget(name: "SotoCryptoTests", dependencies: [ - .byName(name: "SotoCrypto"), - ]), .testTarget( name: "SotoCoreTests", dependencies: [ @@ -97,16 +100,3 @@ let package = Package( ]), ] ) - -// switch for whether to use swift crypto. Swift crypto requires macOS10.15 or iOS13.I'd rather not pass this requirement on -#if os(Linux) -let useSwiftCrypto = true -#else -let useSwiftCrypto = false -#endif - -// Use Swift cypto on Linux. -if useSwiftCrypto { - package.dependencies.append(.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0"..<"3.0.0")) - package.targets.first { $0.name == "SotoCrypto" }?.dependencies.append(.product(name: "Crypto", package: "swift-crypto")) -} diff --git a/Sources/SotoCore/AWSClient+EndpointDiscovery+async.swift b/Sources/SotoCore/AWSClient+EndpointDiscovery+async.swift index 158003822..3efd959ec 100644 --- a/Sources/SotoCore/AWSClient+EndpointDiscovery+async.swift +++ b/Sources/SotoCore/AWSClient+EndpointDiscovery+async.swift @@ -15,7 +15,6 @@ import Logging import NIOCore -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AWSClient { /// Execute an empty request /// - parameters: diff --git a/Sources/SotoCore/AWSClient+Paginate+async.swift b/Sources/SotoCore/AWSClient+Paginate+async.swift index e17b003e5..2f611f44a 100644 --- a/Sources/SotoCore/AWSClient+Paginate+async.swift +++ b/Sources/SotoCore/AWSClient+Paginate+async.swift @@ -15,7 +15,6 @@ import Logging import NIOCore -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AWSClient { /// Used to access paginated results. public struct PaginatorSequence: AsyncSequence where Input.Token: Equatable { diff --git a/Sources/SotoCore/AWSClient+Paginate.swift b/Sources/SotoCore/AWSClient+Paginate.swift index 5493d6f03..2024d11ba 100644 --- a/Sources/SotoCore/AWSClient+Paginate.swift +++ b/Sources/SotoCore/AWSClient+Paginate.swift @@ -59,7 +59,7 @@ extension AWSClient { let responseFuture = command(input, logger, eventLoop) .flatMap { response in return onPage(currentValue, response, eventLoop) - .map { continuePaginate, result -> Void in + .map { continuePaginate, result in guard continuePaginate == true else { return promise.succeed(result) } // get next block token and construct a new input with this token guard let outputToken = response[keyPath: outputKey] else { return promise.succeed(result) } @@ -140,7 +140,7 @@ extension AWSClient { let responseFuture = command(input, logger, eventLoop) .flatMap { response in return onPage(currentValue, response, eventLoop) - .map { continuePaginate, result -> Void in + .map { continuePaginate, result in guard continuePaginate == true else { return promise.succeed(result) } // get next block token and construct a new input with this token guard let token = response[keyPath: tokenKey] else { return promise.succeed(result) } @@ -219,7 +219,7 @@ extension AWSClient { let responseFuture = command(input, logger, eventLoop) .flatMap { response in return onPage(currentValue, response, eventLoop) - .map { continuePaginate, result -> Void in + .map { continuePaginate, result in guard continuePaginate == true else { return promise.succeed(result) } // get next block token and construct a new input with this token guard let token = response[keyPath: tokenKey], diff --git a/Sources/SotoCore/AWSClient+async.swift b/Sources/SotoCore/AWSClient+async.swift index 11c79d332..c94f30b31 100644 --- a/Sources/SotoCore/AWSClient+async.swift +++ b/Sources/SotoCore/AWSClient+async.swift @@ -20,7 +20,6 @@ import Metrics import NIOCore import SotoSignerV4 -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AWSClient { /// Shutdown AWSClient asynchronously. /// diff --git a/Sources/SotoCore/AWSClient.swift b/Sources/SotoCore/AWSClient.swift index e7848398f..9d7e2f853 100644 --- a/Sources/SotoCore/AWSClient.swift +++ b/Sources/SotoCore/AWSClient.swift @@ -637,7 +637,7 @@ extension AWSClient { func execute(attempt: Int) { // execute HTTP request _ = request(eventLoop) - .flatMapThrowing { response throws -> Void in + .flatMapThrowing { response throws in // if it returns an HTTP status code outside 2xx then throw an error guard (200..<300).contains(response.status.code) else { throw self.createError(for: response, serviceConfig: serviceConfig, logger: logger) @@ -645,7 +645,7 @@ extension AWSClient { let output = try processResponse(response) promise.succeed(output) } - .flatMapErrorThrowing { error -> Void in + .flatMapErrorThrowing { error in // if streaming and the error returned is an AWS error fail immediately. Do not attempt // to retry as the streaming function will not know you are retrying if streaming, diff --git a/Sources/SotoCore/AWSService+async.swift b/Sources/SotoCore/AWSService+async.swift index 2322bcc9e..dd03be027 100644 --- a/Sources/SotoCore/AWSService+async.swift +++ b/Sources/SotoCore/AWSService+async.swift @@ -16,7 +16,6 @@ import struct Foundation.URL import NIOCore /// Protocol for services objects. Contains a client to communicate with AWS and config for defining how to communicate -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AWSService { /// Generate a signed URL /// - parameters: diff --git a/Sources/SotoCore/AWSShapes/Payload+async.swift b/Sources/SotoCore/AWSShapes/Payload+async.swift index 89de531f3..2e59a7d02 100644 --- a/Sources/SotoCore/AWSShapes/Payload+async.swift +++ b/Sources/SotoCore/AWSShapes/Payload+async.swift @@ -14,7 +14,6 @@ import NIOCore -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AWSPayload { /// Construct a stream payload from an `AsynSequence` of `ByteBuffers` /// - Parameters: diff --git a/Sources/SotoCore/AWSShapes/Payload.swift b/Sources/SotoCore/AWSShapes/Payload.swift index 0150ef537..96e165bbd 100644 --- a/Sources/SotoCore/AWSShapes/Payload.swift +++ b/Sources/SotoCore/AWSShapes/Payload.swift @@ -83,7 +83,7 @@ public struct AWSPayload { // use chunked reader buffer size to avoid allocating additional buffers when streaming data let blockSize = S3ChunkedStreamReader.bufferSize var leftToRead = size - var readSoFar: Int = 0 + var readSoFar = 0 let stream: StreamReadFunction = { eventLoop in // calculate how much data is left to read, if a file size was indicated var downloadSize = blockSize diff --git a/Sources/SotoCore/Concurrency/FixedSizeByteBufferAsyncSequence.swift b/Sources/SotoCore/Concurrency/FixedSizeByteBufferAsyncSequence.swift index 2e074a388..5e5077a4b 100644 --- a/Sources/SotoCore/Concurrency/FixedSizeByteBufferAsyncSequence.swift +++ b/Sources/SotoCore/Concurrency/FixedSizeByteBufferAsyncSequence.swift @@ -15,7 +15,6 @@ import NIOCore /// An AsyncSequence that returns fixed size ByteBuffers from an AsyncSequence of ByteBuffers -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) public struct FixedSizeByteBufferAsyncSequence: AsyncSequence where Base.Element == ByteBuffer { public typealias Element = ByteBuffer @@ -76,10 +75,8 @@ public struct FixedSizeByteBufferAsyncSequence: AsyncSequen } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension FixedSizeByteBufferAsyncSequence: Sendable where Base: Sendable {} -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AsyncSequence where Element == ByteBuffer { /// Return an AsyncSequence that returns ByteBuffers of a fixed size /// - Parameter chunkSize: Size of each chunk diff --git a/Sources/SotoCore/Concurrency/Sequence+concurrentMap.swift b/Sources/SotoCore/Concurrency/Sequence+concurrentMap.swift index 12fb1e08d..3c3e8a658 100644 --- a/Sources/SotoCore/Concurrency/Sequence+concurrentMap.swift +++ b/Sources/SotoCore/Concurrency/Sequence+concurrentMap.swift @@ -12,7 +12,6 @@ // //===----------------------------------------------------------------------===// -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension Sequence where Element: Sendable { /// Returns an array containing the results of mapping the given async closure over /// the sequence’s elements. diff --git a/Sources/SotoCore/Credential/ConfigFileCredentialProvider.swift b/Sources/SotoCore/Credential/ConfigFileCredentialProvider.swift index 36e03f309..f2438483c 100644 --- a/Sources/SotoCore/Credential/ConfigFileCredentialProvider.swift +++ b/Sources/SotoCore/Credential/ConfigFileCredentialProvider.swift @@ -65,7 +65,7 @@ final class ConfigFileCredentialProvider: CredentialProviderSelector { context: context ) .flatMapThrowing { sharedCredentials in - return try credentialProvider(from: sharedCredentials, context: context, endpoint: endpoint) + return try self.credentialProvider(from: sharedCredentials, context: context, endpoint: endpoint) } } diff --git a/Sources/SotoCore/Credential/CredentialProvider+async.swift b/Sources/SotoCore/Credential/CredentialProvider+async.swift index 4c3d4b404..ed2e59018 100644 --- a/Sources/SotoCore/Credential/CredentialProvider+async.swift +++ b/Sources/SotoCore/Credential/CredentialProvider+async.swift @@ -17,7 +17,6 @@ import NIOCore import SotoSignerV4 /// Async Protocol for providing AWS credentials -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) public protocol AsyncCredentialProvider: CredentialProvider { /// Return credential /// - Parameters: @@ -26,11 +25,10 @@ public protocol AsyncCredentialProvider: CredentialProvider { func getCredential(on eventLoop: EventLoop, logger: Logger) async throws -> Credential } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AsyncCredentialProvider { public func getCredential(on eventLoop: EventLoop, logger: Logger) -> EventLoopFuture { let promise = eventLoop.makePromise(of: Credential.self) - promise.completeWithTask { try await getCredential(on: eventLoop, logger: logger) } + promise.completeWithTask { try await self.getCredential(on: eventLoop, logger: logger) } return promise.futureResult } } diff --git a/Sources/SotoCore/Credential/DeferredCredentialProvider.swift b/Sources/SotoCore/Credential/DeferredCredentialProvider.swift index 81308eece..96cd42b72 100644 --- a/Sources/SotoCore/Credential/DeferredCredentialProvider.swift +++ b/Sources/SotoCore/Credential/DeferredCredentialProvider.swift @@ -26,12 +26,12 @@ public class DeferredCredentialProvider: CredentialProvider { var credential: Credential? { get { self.lock.withLock { - internalCredential + self.internalCredential } } set { self.lock.withLock { - internalCredential = newValue + self.internalCredential = newValue } } } diff --git a/Sources/SotoCore/Encoder/CodableProperties/CollectionCoders.swift b/Sources/SotoCore/Encoder/CodableProperties/CollectionCoders.swift index aa5a12a66..c467f6289 100644 --- a/Sources/SotoCore/Encoder/CodableProperties/CollectionCoders.swift +++ b/Sources/SotoCore/Encoder/CodableProperties/CollectionCoders.swift @@ -38,7 +38,7 @@ extension ArrayCoder: CustomDecoder where Element: Decodable { var container = try topLevelContainer.nestedUnkeyedContainer(forKey: memberKey) while !container.isAtEnd { - values.append(try container.decode(Element.self)) + try values.append(container.decode(Element.self)) } return values } diff --git a/Sources/SotoCore/Encoder/CodableProperties/EC2ArrayCoder.swift b/Sources/SotoCore/Encoder/CodableProperties/EC2ArrayCoder.swift index 9bb3b1f3f..621c7ab25 100644 --- a/Sources/SotoCore/Encoder/CodableProperties/EC2ArrayCoder.swift +++ b/Sources/SotoCore/Encoder/CodableProperties/EC2ArrayCoder.swift @@ -55,7 +55,7 @@ extension EC2ArrayCoder: CustomDecoder where Element: Decodable { var container = try topLevelContainer.nestedUnkeyedContainer(forKey: memberKey) while !container.isAtEnd { - values.append(try container.decode(Element.self)) + try values.append(container.decode(Element.self)) } return values } diff --git a/Sources/SotoCore/HTTP/S3StreamReader.swift b/Sources/SotoCore/HTTP/S3StreamReader.swift index 96eb58e90..43b4050ca 100644 --- a/Sources/SotoCore/HTTP/S3StreamReader.swift +++ b/Sources/SotoCore/HTTP/S3StreamReader.swift @@ -86,7 +86,7 @@ final class S3ChunkedStreamReader: StreamReader { } let promise: EventLoopPromise = eventLoop.makePromise() func _fillBuffer() { - self.read(eventLoop).map { result -> Void in + self.read(eventLoop).map { result in // check if a byte buffer was returned. If not then it must have been `.end` guard case .byteBuffer(var buffer) = result else { if self.bytesLeftToRead == self.workingBuffer.readableBytes { diff --git a/Sources/SotoCore/HTTP/StreamWriter+write.swift b/Sources/SotoCore/HTTP/StreamWriter+write.swift index cedba715f..13eadaa97 100644 --- a/Sources/SotoCore/HTTP/StreamWriter+write.swift +++ b/Sources/SotoCore/HTTP/StreamWriter+write.swift @@ -27,7 +27,7 @@ extension AsyncHTTPClient.HTTPClient.Body.StreamWriter { // get byte buffer from closure, write to StreamWriter, if there are still bytes to write then call // _writeToStreamWriter again. reader.streamChunks(on: eventLoop) - .map { byteBuffers -> Void in + .map { byteBuffers in // if no amount was set and no byte buffers are supppied then this is assumed to mean // there will be no more data if amountLeft == nil, byteBuffers.count == 0 { diff --git a/Sources/SotoCore/Message/AWSRequest.swift b/Sources/SotoCore/Message/AWSRequest.swift index 64f772147..f786778dd 100644 --- a/Sources/SotoCore/Message/AWSRequest.swift +++ b/Sources/SotoCore/Message/AWSRequest.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import Crypto import struct Foundation.CharacterSet import struct Foundation.Data import struct Foundation.Date @@ -19,7 +20,6 @@ import struct Foundation.URL import struct Foundation.URLComponents import NIOCore import NIOHTTP1 -import SotoCrypto import SotoSignerV4 /// Object encapsulating all the information needed to generate a raw HTTP request to AWS @@ -211,7 +211,7 @@ extension AWSRequest { Self.verifyStream(operation: operationName, payload: awsPayload, input: shapeWithPayload) body = .raw(awsPayload) case let shape as AWSEncodableShape: - body = .json(try shape.encodeAsJSON(byteBufferAllocator: configuration.byteBufferAllocator)) + body = try .json(shape.encodeAsJSON(byteBufferAllocator: configuration.byteBufferAllocator)) default: preconditionFailure("Cannot add this as a payload") } @@ -221,7 +221,7 @@ extension AWSRequest { } else { // only include the body if there are members that are output in the body. if memberVariablesCount > 0 { - body = .json(try input.encodeAsJSON(byteBufferAllocator: configuration.byteBufferAllocator)) + body = try .json(input.encodeAsJSON(byteBufferAllocator: configuration.byteBufferAllocator)) } else if httpMethod == .PUT || httpMethod == .POST { // PUT and POST requests require a body even if it is empty. This is not the case with XML body = .json(configuration.byteBufferAllocator.buffer(string: "{}")) @@ -242,7 +242,7 @@ extension AWSRequest { if let encoding = Input.getEncoding(for: payload), case .body(let locationName) = encoding.location { rootName = locationName } - body = .xml(try shape.encodeAsXML(rootName: rootName, namespace: configuration.xmlNamespace)) + body = try .xml(shape.encodeAsXML(rootName: rootName, namespace: configuration.xmlNamespace)) default: preconditionFailure("Cannot add this as a payload") } @@ -252,7 +252,7 @@ extension AWSRequest { } else { // only include the body if there are members that are output in the body. if memberVariablesCount > 0 { - body = .xml(try input.encodeAsXML(namespace: configuration.xmlNamespace)) + body = try .xml(input.encodeAsXML(namespace: configuration.xmlNamespace)) } } diff --git a/Sources/SotoCore/Message/Middleware/S3Middleware.swift b/Sources/SotoCore/Message/Middleware/S3Middleware.swift index 1be962865..a535f72ec 100644 --- a/Sources/SotoCore/Message/Middleware/S3Middleware.swift +++ b/Sources/SotoCore/Message/Middleware/S3Middleware.swift @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// +import Crypto import Foundation -import SotoCrypto import SotoXML /// Middleware applied to S3 service diff --git a/Sources/SotoCore/Message/Middleware/TreeHashMiddleware.swift b/Sources/SotoCore/Message/Middleware/TreeHashMiddleware.swift index 4a465ceb6..62163052b 100644 --- a/Sources/SotoCore/Message/Middleware/TreeHashMiddleware.swift +++ b/Sources/SotoCore/Message/Middleware/TreeHashMiddleware.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import SotoCrypto +import Crypto let MEGA_BYTE = 1024 * 1024 diff --git a/Sources/SotoCore/Waiters/AWSClient+Waiter+async.swift b/Sources/SotoCore/Waiters/AWSClient+Waiter+async.swift index c1ddbc4d2..7e3c69ecc 100644 --- a/Sources/SotoCore/Waiters/AWSClient+Waiter+async.swift +++ b/Sources/SotoCore/Waiters/AWSClient+Waiter+async.swift @@ -15,7 +15,6 @@ import Logging import NIOCore -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension AWSClient { /// Returns when waiter polling returns a success state /// or returns an error if the polling returns an error or timesout diff --git a/Sources/SotoCore/Waiters/Matcher.swift b/Sources/SotoCore/Waiters/Matcher.swift index 9b063ada5..7519a7a82 100644 --- a/Sources/SotoCore/Waiters/Matcher.swift +++ b/Sources/SotoCore/Waiters/Matcher.swift @@ -66,7 +66,7 @@ public struct JMESAnyPathMatcher: AWSWaiterMatch case .success(let output): do { if let searchResult = try expression.search(object: output, as: [CustomStringConvertible].self) { - return searchResult.first { expected == $0.description } != nil + return searchResult.first { self.expected == $0.description } != nil } else { return false } @@ -94,7 +94,7 @@ public struct JMESAllPathMatcher: AWSWaiterMatch case .success(let output): do { if let searchResult = try expression.search(object: output, as: [CustomStringConvertible].self) { - return searchResult.first { expected != $0.description } == nil + return searchResult.first { self.expected != $0.description } == nil } else { return false } diff --git a/Sources/SotoCrypto/ByteArray.swift b/Sources/SotoCrypto/ByteArray.swift deleted file mode 100644 index 2f9d9bd7b..000000000 --- a/Sources/SotoCrypto/ByteArray.swift +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 -#if !os(Linux) - -import protocol Foundation.ContiguousBytes - -/// Protocol for object encapsulating an array of bytes -protocol ByteArray: Sequence, ContiguousBytes, Hashable where Element == UInt8 { - init(bytes: [UInt8]) - var bytes: [UInt8] { get set } -} - -extension ByteArray { - public func makeIterator() -> Array.Iterator { - return bytes.makeIterator() - } - - public init?(bufferPointer: UnsafeRawBufferPointer) { - self.init(bytes: [UInt8](bufferPointer)) - } - - public func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R { - return try bytes.withUnsafeBytes(body) - } -} - -#endif diff --git a/Sources/SotoCrypto/Digest.swift b/Sources/SotoCrypto/Digest.swift deleted file mode 100644 index 5ec7b7454..000000000 --- a/Sources/SotoCrypto/Digest.swift +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import protocol Foundation.ContiguousBytes - -/// Protocol for Digest object returned from HashFunction -public protocol Digest: Sequence, ContiguousBytes, Hashable where Element == UInt8 { - static var byteCount: Int { get } -} - -/// Protocol for Digest object consisting of a byte array -protocol ByteDigest: Digest, ByteArray {} - -#endif diff --git a/Sources/SotoCrypto/HMAC.swift b/Sources/SotoCrypto/HMAC.swift deleted file mode 100644 index 549291857..000000000 --- a/Sources/SotoCrypto/HMAC.swift +++ /dev/null @@ -1,80 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import CommonCrypto -import protocol Foundation.DataProtocol - -/// Hash Authentication Code returned by HMAC -public struct HashAuthenticationCode: ByteArray { - public var bytes: [UInt8] -} - -/// Object generating HMAC for data block given a symmetric key -public struct HMAC { - let key: SymmetricKey - var context: CCHmacContext - - /// return authentication code for data block given a symmetric key - public static func authenticationCode(for data: D, using key: SymmetricKey) -> HashAuthenticationCode { - var hmac = HMAC(key: key) - hmac.update(data: data) - return hmac.finalize() - } - - /// update HMAC calculation with a block of data - public mutating func update(data: D) { - if let digest = data.withContiguousStorageIfAvailable({ bytes in - return self.update(bufferPointer: .init(bytes)) - }) { - return digest - } else { - let buffer = UnsafeMutableBufferPointer.allocate(capacity: data.count) - data.copyBytes(to: buffer) - defer { buffer.deallocate() } - self.update(bufferPointer: .init(buffer)) - } - } -} - -extension HMAC { - /// initialize HMAC with symmetric key - public init(key: SymmetricKey) { - self.key = key - self.context = CCHmacContext() - self.initialize() - } - - /// initialize HMAC calculation - mutating func initialize() { - CCHmacInit(&self.context, H.algorithm, self.key.bytes, self.key.bytes.count) - } - - /// update HMAC calculation with a buffer - public mutating func update(bufferPointer: UnsafeRawBufferPointer) { - CCHmacUpdate(&self.context, bufferPointer.baseAddress, bufferPointer.count) - } - - /// finalize HMAC calculation and return authentication code - public mutating func finalize() -> HashAuthenticationCode { - var authenticationCode: [UInt8] = .init(repeating: 0, count: H.Digest.byteCount) - CCHmacFinal(&self.context, &authenticationCode) - return .init(bytes: authenticationCode) - } -} - -#endif diff --git a/Sources/SotoCrypto/HashFunction.swift b/Sources/SotoCrypto/HashFunction.swift deleted file mode 100644 index 39d48d21c..000000000 --- a/Sources/SotoCrypto/HashFunction.swift +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import CommonCrypto -import protocol Foundation.DataProtocol - -/// Protocol for Hashing function -public protocol HashFunction { - /// associated digest object - associatedtype Digest: SotoCrypto.Digest - - /// hash raw buffer - static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest - - /// initialization - init() - - /// update hash function with data - mutating func update(bufferPointer: UnsafeRawBufferPointer) - /// finalize hash function and return digest - mutating func finalize() -> Self.Digest -} - -extension HashFunction { - /// default version of hash which call init, update and finalize - public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest { - var function = Self() - function.update(bufferPointer: bufferPointer) - return function.finalize() - } - - /// version of hash that takes data in any form that complies with DataProtocol - public static func hash(data: D) -> Self.Digest { - if let digest = data.withContiguousStorageIfAvailable({ bytes in - return self.hash(bufferPointer: .init(bytes)) - }) { - return digest - } else { - let buffer = UnsafeMutableBufferPointer.allocate(capacity: data.count) - data.copyBytes(to: buffer) - defer { buffer.deallocate() } - return self.hash(bufferPointer: .init(buffer)) - } - } - - /// version of update that takes data in any form that complies with DataProtocol - public mutating func update(data: D) { - if let digest = data.withContiguousStorageIfAvailable({ bytes in - return self.update(bufferPointer: .init(bytes)) - }) { - return digest - } else { - let buffer = UnsafeMutableBufferPointer.allocate(capacity: data.count) - data.copyBytes(to: buffer) - defer { buffer.deallocate() } - self.update(bufferPointer: .init(buffer)) - } - } -} - -/// public protocol for Common Crypto hash functions -public protocol CCHashFunction: HashFunction { - static var algorithm: CCHmacAlgorithm { get } -} - -#endif diff --git a/Sources/SotoCrypto/Insecure.swift b/Sources/SotoCrypto/Insecure.swift deleted file mode 100644 index 9e6260b17..000000000 --- a/Sources/SotoCrypto/Insecure.swift +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -public enum Insecure {} - -#endif diff --git a/Sources/SotoCrypto/MD5.swift b/Sources/SotoCrypto/MD5.swift deleted file mode 100644 index cd9eac1df..000000000 --- a/Sources/SotoCrypto/MD5.swift +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import CommonCrypto - -public extension Insecure { - struct MD5Digest: ByteDigest { - public static var byteCount: Int { return Int(CC_MD5_DIGEST_LENGTH) } - public var bytes: [UInt8] - } - - struct MD5: CCHashFunction { - public typealias Digest = MD5Digest - public static var algorithm: CCHmacAlgorithm { return CCHmacAlgorithm(kCCHmacAlgMD5) } - var context: CC_MD5_CTX - - public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_MD5(bufferPointer.baseAddress, CC_LONG(bufferPointer.count), &digest) - return .init(bytes: digest) - } - - public init() { - self.context = CC_MD5_CTX() - CC_MD5_Init(&self.context) - } - - public mutating func update(bufferPointer: UnsafeRawBufferPointer) { - CC_MD5_Update(&self.context, bufferPointer.baseAddress, CC_LONG(bufferPointer.count)) - } - - public mutating func finalize() -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_MD5_Final(&digest, &self.context) - return .init(bytes: digest) - } - } -} - -#endif diff --git a/Sources/SotoCrypto/SHA1.swift b/Sources/SotoCrypto/SHA1.swift deleted file mode 100644 index e3355f0fd..000000000 --- a/Sources/SotoCrypto/SHA1.swift +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2022 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import CommonCrypto - -public extension Insecure { - struct SHA1Digest: ByteDigest { - public static var byteCount: Int { return Int(CC_SHA1_DIGEST_LENGTH) } - public var bytes: [UInt8] - } - - struct SHA1: CCHashFunction { - public typealias Digest = SHA1Digest - public static var algorithm: CCHmacAlgorithm { return CCHmacAlgorithm(kCCHmacAlgSHA1) } - var context: CC_SHA1_CTX - - public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA1(bufferPointer.baseAddress, CC_LONG(bufferPointer.count), &digest) - return .init(bytes: digest) - } - - public init() { - self.context = CC_SHA1_CTX() - CC_SHA1_Init(&self.context) - } - - public mutating func update(bufferPointer: UnsafeRawBufferPointer) { - CC_SHA1_Update(&self.context, bufferPointer.baseAddress, CC_LONG(bufferPointer.count)) - } - - public mutating func finalize() -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA1_Final(&digest, &self.context) - return .init(bytes: digest) - } - } -} - -#endif diff --git a/Sources/SotoCrypto/SHA2.swift b/Sources/SotoCrypto/SHA2.swift deleted file mode 100644 index 4e69f004c..000000000 --- a/Sources/SotoCrypto/SHA2.swift +++ /dev/null @@ -1,117 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import CommonCrypto - -public struct SHA256Digest: ByteDigest { - public static var byteCount: Int { return Int(CC_SHA256_DIGEST_LENGTH) } - public var bytes: [UInt8] -} - -public struct SHA256: CCHashFunction { - public typealias Digest = SHA256Digest - public static var algorithm: CCHmacAlgorithm { return CCHmacAlgorithm(kCCHmacAlgSHA256) } - var context: CC_SHA256_CTX - - public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA256(bufferPointer.baseAddress, CC_LONG(bufferPointer.count), &digest) - return .init(bytes: digest) - } - - public init() { - self.context = CC_SHA256_CTX() - CC_SHA256_Init(&self.context) - } - - public mutating func update(bufferPointer: UnsafeRawBufferPointer) { - CC_SHA256_Update(&self.context, bufferPointer.baseAddress, CC_LONG(bufferPointer.count)) - } - - public mutating func finalize() -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA256_Final(&digest, &self.context) - return .init(bytes: digest) - } -} - -public struct SHA384Digest: ByteDigest { - public static var byteCount: Int { return Int(CC_SHA384_DIGEST_LENGTH) } - public var bytes: [UInt8] -} - -public struct SHA384: CCHashFunction { - public typealias Digest = SHA384Digest - public static var algorithm: CCHmacAlgorithm { return CCHmacAlgorithm(kCCHmacAlgSHA384) } - var context: CC_SHA512_CTX - - public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA384(bufferPointer.baseAddress, CC_LONG(bufferPointer.count), &digest) - return .init(bytes: digest) - } - - public init() { - self.context = CC_SHA512_CTX() - CC_SHA384_Init(&self.context) - } - - public mutating func update(bufferPointer: UnsafeRawBufferPointer) { - CC_SHA384_Update(&self.context, bufferPointer.baseAddress, CC_LONG(bufferPointer.count)) - } - - public mutating func finalize() -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA384_Final(&digest, &self.context) - return .init(bytes: digest) - } -} - -public struct SHA512Digest: ByteDigest { - public static var byteCount: Int { return Int(CC_SHA512_DIGEST_LENGTH) } - public var bytes: [UInt8] -} - -public struct SHA512: CCHashFunction { - public typealias Digest = SHA512Digest - public static var algorithm: CCHmacAlgorithm { return CCHmacAlgorithm(kCCHmacAlgSHA512) } - var context: CC_SHA512_CTX - - public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA512(bufferPointer.baseAddress, CC_LONG(bufferPointer.count), &digest) - return .init(bytes: digest) - } - - public init() { - self.context = CC_SHA512_CTX() - CC_SHA512_Init(&self.context) - } - - public mutating func update(bufferPointer: UnsafeRawBufferPointer) { - CC_SHA512_Update(&self.context, bufferPointer.baseAddress, CC_LONG(bufferPointer.count)) - } - - public mutating func finalize() -> Self.Digest { - var digest: [UInt8] = .init(repeating: 0, count: Digest.byteCount) - CC_SHA512_Final(&digest, &self.context) - return .init(bytes: digest) - } -} - -#endif diff --git a/Sources/SotoCrypto/SymmetricKey.swift b/Sources/SotoCrypto/SymmetricKey.swift deleted file mode 100644 index b8be79d96..000000000 --- a/Sources/SotoCrypto/SymmetricKey.swift +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if !os(Linux) - -import protocol Foundation.ContiguousBytes - -/// Symmetric key object -public struct SymmetricKey: ContiguousBytes { - let bytes: [UInt8] - - public var bitCount: Int { - return self.bytes.count * 8 - } - - public init(data: D) where D: ContiguousBytes { - let bytes = data.withUnsafeBytes { buffer in - return [UInt8](buffer) - } - self.bytes = bytes - } - - public func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R { - return try self.bytes.withUnsafeBytes(body) - } -} - -#endif diff --git a/Sources/SotoCrypto/exports.swift b/Sources/SotoCrypto/exports.swift deleted file mode 100644 index 3b47ebac4..000000000 --- a/Sources/SotoCrypto/exports.swift +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Soto for AWS open source project -// -// Copyright (c) 2017-2020 the Soto project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Soto project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// Replicating the CryptoKit framework interface for < macOS 10.15 - -#if os(Linux) -@_exported import Crypto -#endif diff --git a/Sources/SotoSignerV4/signer.swift b/Sources/SotoSignerV4/signer.swift index b5814402a..df8d05c1c 100644 --- a/Sources/SotoSignerV4/signer.swift +++ b/Sources/SotoSignerV4/signer.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import Crypto import struct Foundation.CharacterSet import struct Foundation.Data import struct Foundation.Date @@ -20,7 +21,6 @@ import struct Foundation.Locale import struct Foundation.TimeZone import struct Foundation.URL import struct Foundation.URLComponents -import SotoCrypto /// Amazon Web Services V4 Signer public struct AWSSigner: Sendable { diff --git a/Sources/SotoTestUtils/TestServer.swift b/Sources/SotoTestUtils/TestServer.swift index 62967e64f..4467ec631 100644 --- a/Sources/SotoTestUtils/TestServer.swift +++ b/Sources/SotoTestUtils/TestServer.swift @@ -242,7 +242,7 @@ extension AWSTestServer { case .v1: return .error(.notImplemented, continueProcessing: true) case .v2: - var responseBody = byteBufferAllocator.buffer(capacity: token.utf8.count) + var responseBody = self.byteBufferAllocator.buffer(capacity: token.utf8.count) responseBody.writeString(token) let headers: [String: String] = [:] return .result(.init(httpStatus: .ok, headers: headers, body: responseBody), continueProcessing: true) @@ -253,7 +253,7 @@ extension AWSTestServer { guard version == .v1 || request.headers[InstanceMetaData.TokenHeaderName] == token else { return .error(.badRequest, continueProcessing: false) } - var responseBody = byteBufferAllocator.buffer(capacity: ec2Role.utf8.count) + var responseBody = self.byteBufferAllocator.buffer(capacity: ec2Role.utf8.count) responseBody.writeString(ec2Role) let headers: [String: String] = [:] return .result(.init(httpStatus: .ok, headers: headers, body: responseBody), continueProcessing: true) @@ -262,7 +262,7 @@ extension AWSTestServer { // credentials let encoder = JSONEncoder() encoder.dateEncodingStrategy = .formatted(dateFormatter) - let responseBody = try encoder.encodeAsByteBuffer(metaData, allocator: byteBufferAllocator) + let responseBody = try encoder.encodeAsByteBuffer(metaData, allocator: self.byteBufferAllocator) let headers = [ "Content-Type": "application/json", ] @@ -285,7 +285,7 @@ extension AWSTestServer { if request.method == .GET, request.uri == path { let encoder = JSONEncoder() encoder.dateEncodingStrategy = .formatted(dateFormatter) - let responseBody = try encoder.encodeAsByteBuffer(metaData, allocator: byteBufferAllocator) + let responseBody = try encoder.encodeAsByteBuffer(metaData, allocator: self.byteBufferAllocator) let headers = [ "Content-Type": "application/json", ] diff --git a/Sources/SotoXML/XMLEncoder.swift b/Sources/SotoXML/XMLEncoder.swift index 2185c07c5..4ebdac0d9 100644 --- a/Sources/SotoXML/XMLEncoder.swift +++ b/Sources/SotoXML/XMLEncoder.swift @@ -207,12 +207,12 @@ class _XMLEncoder: Encoder { } func encode(_ value: Double, forKey key: Key) throws { - let childElement = XML.Element(name: key.stringValue, stringValue: try encoder.box(value)) + let childElement = try XML.Element(name: key.stringValue, stringValue: encoder.box(value)) element.addChild(childElement) } func encode(_ value: Float, forKey key: Key) throws { - let childElement = XML.Element(name: key.stringValue, stringValue: try encoder.box(value)) + let childElement = try XML.Element(name: key.stringValue, stringValue: encoder.box(value)) element.addChild(childElement) } @@ -351,13 +351,13 @@ class _XMLEncoder: Encoder { } mutating func encode(_ value: Double) throws { - let childElement = XML.Element(name: key, stringValue: try encoder.box(value)) + let childElement = try XML.Element(name: key, stringValue: encoder.box(value)) element.addChild(childElement) count += 1 } mutating func encode(_ value: Float) throws { - let childElement = XML.Element(name: key, stringValue: try encoder.box(value)) + let childElement = try XML.Element(name: key, stringValue: encoder.box(value)) element.addChild(childElement) count += 1 } @@ -454,15 +454,15 @@ extension _XMLEncoder: SingleValueEncodingContainer { } func encode(_ value: Double) throws { - storage.push(container: XML.Element(name: currentKey, stringValue: try box(value))) + try storage.push(container: XML.Element(name: currentKey, stringValue: box(value))) } func encode(_ value: Float) throws { - storage.push(container: XML.Element(name: currentKey, stringValue: try box(value))) + try storage.push(container: XML.Element(name: currentKey, stringValue: box(value))) } func encode(_ value: T) throws where T: Encodable { - storage.push(container: try box(value)) + try storage.push(container: box(value)) } } diff --git a/Tests/SotoCoreTests/Concurrency/AsyncSequenceTests.swift b/Tests/SotoCoreTests/Concurrency/AsyncSequenceTests.swift index 286c170c7..bd168802c 100644 --- a/Tests/SotoCoreTests/Concurrency/AsyncSequenceTests.swift +++ b/Tests/SotoCoreTests/Concurrency/AsyncSequenceTests.swift @@ -17,7 +17,6 @@ import SotoCore import SotoTestUtils import XCTest -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) final class AsyncSequenceTests: XCTestCase { func testFixedSizeByteBufferSequence( bufferSize: Int, @@ -68,7 +67,6 @@ final class AsyncSequenceTests: XCTestCase { } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) struct TestByteBufferSequence: AsyncSequence { typealias Element = ByteBuffer let source: ByteBuffer diff --git a/Tests/SotoCoreTests/Concurrency/Count.swift b/Tests/SotoCoreTests/Concurrency/Count.swift index 8db400768..03eae42b6 100644 --- a/Tests/SotoCoreTests/Concurrency/Count.swift +++ b/Tests/SotoCoreTests/Concurrency/Count.swift @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// // Count type for testing concurrency primitives -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) actor Count { var value: Int diff --git a/Tests/SotoCoreTests/Concurrency/Sequence+concurrentMapTests.swift b/Tests/SotoCoreTests/Concurrency/Sequence+concurrentMapTests.swift index 9fcb28076..ac1a9fca6 100644 --- a/Tests/SotoCoreTests/Concurrency/Sequence+concurrentMapTests.swift +++ b/Tests/SotoCoreTests/Concurrency/Sequence+concurrentMapTests.swift @@ -15,7 +15,6 @@ import SotoCore import XCTest -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) final class MapTests: XCTestCase { func testConcurrentMap() async throws { let array = Array(0..<800) diff --git a/Tests/SotoCoreTests/EndpointDiscoveryTests.swift b/Tests/SotoCoreTests/EndpointDiscoveryTests.swift index 1d8b2cf7a..7b152f183 100644 --- a/Tests/SotoCoreTests/EndpointDiscoveryTests.swift +++ b/Tests/SotoCoreTests/EndpointDiscoveryTests.swift @@ -18,7 +18,6 @@ import SotoCore import SotoTestUtils import XCTest -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) final class EndpointDiscoveryTests: XCTestCase { final class Service: AWSService { let client: AWSClient diff --git a/Tests/SotoCoreTests/PaginateTests.swift b/Tests/SotoCoreTests/PaginateTests.swift index bec58b055..c957acb9e 100644 --- a/Tests/SotoCoreTests/PaginateTests.swift +++ b/Tests/SotoCoreTests/PaginateTests.swift @@ -20,7 +20,6 @@ import NIOPosix import SotoTestUtils import XCTest -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) final class PaginateAsyncTests: XCTestCase, @unchecked Sendable { enum Error: Swift.Error { case didntFindToken