Protocols

The following protocols are available globally.

Claims

  • A protocol for representing the claims on a JSON web token. https://tools.ietf.org/html/rfc7519#section-4.1

    Usage Example:

    struct AdminClaims: Claims {
        var sub: String
        var isAdmin: Bool
        var exp: Date?
    }
     let jwt = JWT(claims: AdminClaims(sub: "Kitura", isAdmin: true, exp: Date(timeIntervalSinceNow: 3600)))
    
    See more

    Declaration

    Swift

    public protocol Claims : Decodable, Encodable