Skip to content

Commit

Permalink
Swift 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-mladenovic committed Dec 27, 2019
1 parent 6767d1c commit dada580
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AwsSign.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AwsSign is a Swift library that enables you to sign `URLRequest`s using Signatur

<p>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat" alt="Swift 4.2">
<img src="https://img.shields.io/badge/Swift-5.1-orange.svg?style=flat" alt="Swift 5.1">
</a>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Platforms-iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-4E4E4E.svg?colorA=EF5138" alt="Platforms iOS | macOS | watchOS | tvOS | Linux">
Expand All @@ -14,7 +14,7 @@ AwsSign is a Swift library that enables you to sign `URLRequest`s using Signatur
</a>
</p>

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

Expand Down
5 changes: 4 additions & 1 deletion Source/AwsSign.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import CryptoSwift

public extension URLRequest {
Expand All @@ -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") }
Expand Down

0 comments on commit dada580

Please sign in to comment.