Skip to content

Commit

Permalink
Merge pull request #58 from vapor-community/update-to-vapor-rc
Browse files Browse the repository at this point in the history
Update for latest Vapor release candidate
  • Loading branch information
gwynne authored Mar 13, 2020
2 parents ac511fe + b8c8d8f commit 9d74a47
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
macos:
macos:
xcode: "9.3"
xcode: "11.4"
steps:
- run: brew install vapor/tap/vapor
- checkout
Expand All @@ -12,7 +12,7 @@ jobs:

linux:
docker:
- image: norionomura/swift:swift-4.1-branch
- image: vapor/swift:5.2
steps:
- checkout
- run: apt-get update
Expand Down
73 changes: 32 additions & 41 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,64 @@
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
"state": {
"branch": null,
"revision": "48e284d1ea6d0e8baac1af1c4ad8bd298670caf6",
"version": "1.0.1"
"revision": "e2636a4c24e646d3e480fc666da0c090818beb09",
"version": "1.1.0"
}
},
{
"package": "async-kit",
"repositoryURL": "https://github.com/vapor/async-kit.git",
"state": {
"branch": null,
"revision": "8e9d41f31848809732661563b334c1bb1c93cf1a",
"version": "1.0.0-beta.2.2"
"revision": "094dad1142e4e272a328ab44edd39730f246fb3e",
"version": "1.0.0-rc.1"
}
},
{
"package": "console-kit",
"repositoryURL": "https://github.com/vapor/console-kit.git",
"state": {
"branch": null,
"revision": "54585747b6a5c435b7852c026028710fd7a94bec",
"version": "4.0.0-beta.2.1"
"revision": "de99d83c9f3c298371002729cc0601e4b5d9e0c9",
"version": "4.0.0-rc.1"
}
},
{
"package": "jwt-kit",
"repositoryURL": "https://github.com/vapor/jwt-kit.git",
"state": {
"branch": null,
"revision": "01c623f7dd82c3d4fd020ce87f19d858449989d3",
"version": "4.0.0-beta.2.2"
}
},
{
"package": "multipart-kit",
"repositoryURL": "https://github.com/vapor/multipart-kit.git",
"state": {
"branch": null,
"revision": "b41a49b5756ac3fbf8f2b07228a7e75f9b60731a",
"version": "4.0.0-beta.2"
}
},
{
"package": "open-crypto",
"repositoryURL": "https://github.com/vapor/open-crypto.git",
"state": {
"branch": null,
"revision": "90c49bc68ee6d992fa13cf84ca8fc54b97eaf4cc",
"version": "4.0.0-beta.2"
"revision": "f1d0e511420ab4ea0f8445a80b74cd347bee2ee6",
"version": "4.0.0-rc.1.1"
}
},
{
"package": "routing-kit",
"repositoryURL": "https://github.com/vapor/routing-kit.git",
"state": {
"branch": null,
"revision": "6a8a1636ad26494b03f3c72d74a420fc3a44949c",
"version": "4.0.0-beta.3"
"revision": "dbc3eafdbe243e9a46eeb6fd7d99266bee52f89f",
"version": "4.0.0-rc.1"
}
},
{
"package": "swift-backtrace",
"repositoryURL": "https://github.com/ianpartridge/swift-backtrace.git",
"repositoryURL": "https://github.com/swift-server/swift-backtrace.git",
"state": {
"branch": null,
"revision": "eaf2cef011c0c23d1701aa60b364def8015dc3c7",
"version": "1.1.1"
}
},
{
"package": "swift-crypto",
"repositoryURL": "https://github.com/apple/swift-crypto.git",
"state": {
"branch": null,
"revision": "9be4a93a76d4b80105044747b35d456de7289c87",
"version": "1.0.0"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
Expand All @@ -87,17 +78,17 @@
"repositoryURL": "https://github.com/apple/swift-metrics.git",
"state": {
"branch": null,
"revision": "3fefedaaef285830cc98ae80231140122076a7e0",
"version": "1.2.0"
"revision": "708b960b4605abb20bc55d65abf6bad607252200",
"version": "2.0.0"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "df9390006bce7da1b6273f804d3acbbfdfcc6154",
"version": "2.13.1"
"revision": "16ab4d657e1ad4e77bd5f8b94af8538561643053",
"version": "2.14.0"
}
},
{
Expand All @@ -114,35 +105,35 @@
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
"state": {
"branch": null,
"revision": "c1bfb7ce3f201e41ff60ef38fa63e67e0eb66a24",
"version": "1.9.0"
"revision": "65ebab9db70623bf1b58305edaa26ee5629856ed",
"version": "1.9.1"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "cf54f5c1db1c3740a6c7d662dc8569c150c3846c",
"version": "2.6.0"
"revision": "af46d9b58fafbb76f9b01177568d435a1b024f99",
"version": "2.6.2"
}
},
{
"package": "vapor",
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "a9e417a0040a32368c49a0af14266e02d963779b",
"version": "4.0.0-beta.3.12"
"revision": "6954c471dc6b405dcafde2fa026b37ff5b07b08f",
"version": "4.0.0-rc.3.4"
}
},
{
"package": "websocket-kit",
"repositoryURL": "https://github.com/vapor/websocket-kit.git",
"state": {
"branch": null,
"revision": "766b4b0005a158550c345671c8e7cea42af104b6",
"version": "2.0.0-beta.2.3"
"revision": "aac462481bcd3039d5db9a0fbe7f4e47eefe2295",
"version": "2.0.0-rc.1"
}
}
]
Expand Down
11 changes: 5 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// swift-tools-version:5.1

// swift-tools-version:5.2
import PackageDescription

let package = Package(
Expand All @@ -11,15 +10,15 @@ let package = Package(
.library(name: "Imperial", targets: ["Imperial"]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-alpha.3"),
.package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0-alpha.1.1")
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-rc"),
.package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0-rc")
],
targets: [
.target(
name: "Imperial",
dependencies: [
"Vapor",
"JWTKit"
.product(name: "Vapor", package: "vapor"),
.product(name: "JWTKit", package: "jwt-kit"),
]
),
.testTarget(name: "ImperialTests", dependencies: ["Imperial"]),
Expand Down
2 changes: 1 addition & 1 deletion Sources/Imperial/Services/GoogleJWT/GoogleJWTRouter.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import OpenCrypto
import Crypto
import Vapor
import JWTKit

Expand Down
22 changes: 20 additions & 2 deletions Sources/Imperial/Services/Shopify/URL+Shopify.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import OpenCrypto
import Crypto

extension URL {

Expand All @@ -10,7 +10,7 @@ extension URL {
let queryString = queryItems.joined(separator: "&")

let hmac = HMAC<SHA256>.authenticationCode(for: queryString.bytes, using: .init(data: key.bytes))
return hmac.description
return hmac.hex
}

func isValidShopifyDomain() -> Bool {
Expand All @@ -21,3 +21,21 @@ extension URL {
return absoluteString.range(of: "^[a-z0-9.-]+.myshopify.com$", options: .regularExpression) != nil
}
}

extension ContiguousBytes {
public var hex: String {
let table: [UInt8] = [
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66
]

return String(decoding: self.withUnsafeBytes { buffer in
Array<UInt8>.init(unsafeUninitializedCapacity: buffer.count * 2) { output, outCount in
outCount = buffer.reduce(into: 0) { count, byte in
output[count + 0] = table[Int(byte / 16)]
output[count + 1] = table[Int(byte % 16)]
count += 2
}
}
}, as: Unicode.ASCII.self)
}
}

0 comments on commit 9d74a47

Please sign in to comment.