Swiftpack.co - Package - vapor/jwt

JWTKit

Documentation Team Chat MIT License Continuous Integration Swift 5.0


Original author

Github

link
Stars: 240
Help us keep the lights on

Dependencies

Releases

4.0.0-beta.2 - Dec 9, 2019

This package is now a Vapor + JWTKit integration.

import JWT
import Vapor

try app.jwt.signers.use(.es512(key: .generate()))

app.post("login") { req -> LoginResponse in
    let credentials = try req.content.decode(LoginCredentials.self)
    return try LoginResponse(
        token: req.jwt.sign(User(name: credentials.name))
    )
}

app.get("me") { req -> String in
    try req.jwt.verify(as: User.self).name
}

3.1.1 - Oct 24, 2019

  • Fixed warnings about public access modifier being redundant. (#108)

3.1.0 - Oct 23, 2019

  • Adds JWK signer support. (#106)
let json = """
{"kty":"RSA", ...}
"""
let signer = try JWTSigner.jwk(key: json)

4.0.0-alpha.1.3 - Oct 7, 2019

  • Fixed an intermittent verification failure with ECDSA signed tokens. (#103, #104)

4.0.0-alpha.1.2 - Aug 29, 2019

  • Fixed ECDSA signature encoding to follow spec. (#100, #102)