diff --git a/AwsSign.podspec b/AwsSign.podspec index af886ad..42f2c16 100644 --- a/AwsSign.podspec +++ b/AwsSign.podspec @@ -9,13 +9,13 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/nikola-mladenovic/AwsSwiftSign.git", :tag => s.version.to_s } s.source_files = 'Source/*.swift' s.swift_version = "4.2" - s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' } + s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5.1' } s.ios.deployment_target = '10.0' s.osx.deployment_target = '10.10' s.tvos.deployment_target = '9.0' s.watchos.deployment_target = '2.2' - s.dependency 'CryptoSwift', '~> 0.12' + s.dependency 'CryptoSwift', '~> 1.3' end diff --git a/Package.swift b/Package.swift index 8ef6e09..e4de413 100755 --- a/Package.swift +++ b/Package.swift @@ -1,11 +1,11 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.1 import PackageDescription let package = Package( name: "AwsSign", products: [.library(name: "AwsSign", targets: ["AwsSign"])], - dependencies: [.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "0.12.0")], + dependencies: [.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.3.0")], targets: [.target(name: "AwsSign", dependencies: ["CryptoSwift"], path: "Source")], - swiftLanguageVersions: [.v4_2] + swiftLanguageVersions: [.v5] ) diff --git a/README.md b/README.md index f0ce0a2..055a878 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ AwsSign is a Swift library that enables you to sign `URLRequest`s using Signatur
- + @@ -14,7 +14,7 @@ AwsSign is a Swift library that enables you to sign `URLRequest`s using Signatur
-This package builds with Swift Package Manager. Ensure you have installed and activated the latest Swift 4.2 tool chain. +This package builds with Swift Package Manager. Ensure you have installed and activated the latest Swift 5.1 tool chain. ## Quick Start diff --git a/Source/AwsSign.swift b/Source/AwsSign.swift index 1b56698..13c1b85 100755 --- a/Source/AwsSign.swift +++ b/Source/AwsSign.swift @@ -1,4 +1,7 @@ import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif import CryptoSwift public extension URLRequest { @@ -20,7 +23,7 @@ public extension URLRequest { return (full: date, short: String(shortDate)) } - public mutating func sign(accessKeyId: String, secretAccessKey: String) throws { + mutating func sign(accessKeyId: String, secretAccessKey: String) throws { guard let url = url, let host = url.host, let method = httpMethod else { throw SignError.generalError(reason: "URLRequest doesn't have a proper URL") } let hostComponents = host.components(separatedBy: ".") guard hostComponents.count > 3 else { throw SignError.generalError(reason: "Incorrect host format. The host should contain service name and region, e.g sns.us-east-1.amazonaws.com") }