Classes
The following classes are available globally.
-
A class representing the MicroProfile claims as listed in MicroProfile specs.
See moreDeclaration
Swift
public class ClaimsMicroProfile : Claims
-
A class representing OpenID related claims as decsribed in OpenID specs.
See moreDeclaration
Swift
public class ClaimsOpenID : Claims
-
A thread safe encoder that signs the JWT header and claims using the provided algorithm and encodes a
JWT
instance as either Data or a JWT String.Usage Example:
See morestruct MyClaims: Claims { var name: String } var jwt = JWT(claims: MyClaims(name: "John Doe")) let privateKey = "<PrivateKey>".data(using: .utf8)! let rsaJWTEncoder = JWTEncoder(jwtSigner: JWTSigner.rs256(privateKey: privateKey)) do { let jwtString = try rsaJWTEncoder.encodeToString(jwt) } catch { print("Failed to encode JWT: \(error)") }
Declaration
Swift
public class JWTEncoder : BodyEncoder
-
A thread safe decoder that decodes either Data or a JWT String as a
JWT
instance and verifies the signiture using the provided algorithm.Usage Example:
See morestruct MyClaims: Claims { var name: String } let publicKey = "<PublicKey>".data(using: .utf8)! let rsaJWTDecoder = JWTDecoder(jwtVerifier: JWTVerifier.rs256(publicKey: publicKey)) do { let jwt = try rsaJWTDecoder.decode(JWT<MyClaims>.self, fromString: exampleJWTString) } catch { print("Failed to decode JWT: \(error)") }
Declaration
Swift
public class JWTDecoder : BodyDecoder