Skip to content

Commit

Permalink
Swift 5.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mw99 committed Jun 11, 2019
1 parent 191795a commit 2b14d3c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion OhhAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Pod::Spec.new do |s|
s.name = "OhhAuth"
s.version = "1.0.0"
s.version = "1.1.0"
s.summary = "Pure Swift implementation of the OAuth 1.0 protocol as an easy to use extension for the URLRequest type. (RFC-5849)"
s.authors = "Markus Wanke"
s.homepage = "https://github.com/mw99/OhhAuth"
s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
s.source = { :git => "https://github.com/mw99/OhhAuth.git", :tag => s.version }

s.swift_version = '5'

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0'
Expand Down
10 changes: 9 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "OhhAuth"
name: "OhhAuth",
products: [
.library(name: "OhhAuth", targets: ["OhhAuth"])
],
targets: [
.target(name: "OhhAuth", path: ".")
]
)
10 changes: 5 additions & 5 deletions Sources/OhhAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import Foundation

open class OhhAuth
public class OhhAuth
{
/// Tuple to represent signing credentials. (consumer as well as user credentials)
public typealias Credentials = (key: String, secret: String)
Expand All @@ -41,7 +41,7 @@ open class OhhAuth
/// - userCredentials: user credentials (nil if this is a request without user association)
///
/// - Returns: OAuth HTTP header entry for the Authorization field.
open static func calculateSignature(url: URL, method: String, parameter: [String: String],
static func calculateSignature(url: URL, method: String, parameter: [String: String],
consumerCredentials cc: Credentials, userCredentials uc: Credentials?) -> String
{
typealias Tup = (key: String, value: String)
Expand Down Expand Up @@ -99,7 +99,7 @@ open class OhhAuth
/// - Parameter paras: url-form parameters
/// - Parameter encoding: used string encoding (default: .utf8)
/// - Returns: correctly percentage encoded url-form parameters
open static func httpBody(forFormParameters paras: [String: String], encoding: String.Encoding = .utf8) -> Data?
static func httpBody(forFormParameters paras: [String: String], encoding: String.Encoding = .utf8) -> Data?
{
let trans: (String, String) -> String = { k, v in
return rfc3986encode(k) + "=" + rfc3986encode(v)
Expand Down Expand Up @@ -154,7 +154,7 @@ public extension URLRequest
/// - paras: url-form parameters
/// - consumerCredentials: consumer credentials
/// - userCredentials: user credentials (nil if this is a request without user association)
public mutating func oAuthSign(method: String, urlFormParameters paras: [String: String],
mutating func oAuthSign(method: String, urlFormParameters paras: [String: String],
consumerCredentials cc: OhhAuth.Credentials, userCredentials uc: OhhAuth.Credentials? = nil)
{
self.httpMethod = method.uppercased()
Expand Down Expand Up @@ -182,7 +182,7 @@ public extension URLRequest
/// - contentType: HTTP header "Content-Type" entry (default: nil)
/// - consumerCredentials: consumer credentials
/// - userCredentials: user credentials (nil if this is a request without user association)
public mutating func oAuthSign(method: String, body: Data? = nil, contentType: String? = nil,
mutating func oAuthSign(method: String, body: Data? = nil, contentType: String? = nil,
consumerCredentials cc: OhhAuth.Credentials, userCredentials uc: OhhAuth.Credentials? = nil)
{
self.httpMethod = method.uppercased()
Expand Down

0 comments on commit 2b14d3c

Please sign in to comment.