From 690a134c7135fad8238526d2e07ea6e1b3599694 Mon Sep 17 00:00:00 2001 From: Paul Toffoloni <69189821+ptoffy@users.noreply.github.com> Date: Sun, 17 Mar 2024 16:35:34 +0100 Subject: [PATCH] Update to JWTKit Beta 2 (#152) Switch to Beta 2 Co-authored-by: Jaap Wijnen --- Package.swift | 2 +- Sources/JWT/Request+JWT.swift | 4 ++-- Tests/JWTTests/JWTTests.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index ebb1be1..0571624 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( .library(name: "JWT", targets: ["JWT"]), ], dependencies: [ - .package(url: "https://github.com/vapor/jwt-kit.git", from: "5.0.0-beta.1"), + .package(url: "https://github.com/vapor/jwt-kit.git", from: "5.0.0-beta.2"), .package(url: "https://github.com/vapor/vapor.git", from: "4.92.0"), ], targets: [ diff --git a/Sources/JWT/Request+JWT.swift b/Sources/JWT/Request+JWT.swift index 300b943..e153d03 100644 --- a/Sources/JWT/Request+JWT.swift +++ b/Sources/JWT/Request+JWT.swift @@ -34,10 +34,10 @@ public extension Request { try await self._request.application.jwt.keys.verify(message, as: Payload.self) } - public func sign(_ jwt: Payload, header: JWTHeader = .init()) async throws -> String + public func sign(_ jwt: Payload, kid: JWKIdentifier? = nil, header: JWTHeader = .init()) async throws -> String where Payload: JWTPayload { - return try await self._request.application.jwt.keys.sign(jwt, header: header) + return try await self._request.application.jwt.keys.sign(jwt, kid: kid, header: header) } } } diff --git a/Tests/JWTTests/JWTTests.swift b/Tests/JWTTests/JWTTests.swift index 55ccd6e..275ba3c 100644 --- a/Tests/JWTTests/JWTTests.swift +++ b/Tests/JWTTests/JWTTests.swift @@ -84,7 +84,7 @@ class JWTTests: XCTestCase { ) // Return the signed JWT return try await [ - "token": req.jwt.sign(payload, header: ["kid": "a"]), + "token": req.jwt.sign(payload, kid: "a"), ] }