Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extensions |
|
JWT encoding definition
This module can be considered internal to the library
Users should never need to implement the Encode
typeclass or use any of the exported functions or types directly.
You'll only need to know of Encode
typeclass if you want to write a function polymorphic in the type of payloads.
If you want to extend the types supported by the library, see Libjwt.Classes
Synopsis
- type EncodeResult = JwtIO ()
- class Encode c where
- encode :: c -> JwtT -> EncodeResult
- class ClaimEncoder t where
- encodeClaim :: String -> t -> JwtT -> EncodeResult
- nullEncode :: b -> EncodeResult
Documentation
type EncodeResult = JwtIO () Source #
Definition of claims encoding.
The only use for the user is probably to write a function that is polymorphic in the payload type.
encode :: c -> JwtT -> EncodeResult Source #
Perform the encoding as impure action
Instances
Encode Header Source # | |
Defined in Libjwt.Header | |
Encode Jti Source # | |
Defined in Libjwt.RegisteredClaims | |
Encode Iat Source # | |
Defined in Libjwt.RegisteredClaims | |
Encode Nbf Source # | |
Defined in Libjwt.RegisteredClaims | |
Encode Exp Source # | |
Defined in Libjwt.RegisteredClaims | |
Encode Aud Source # | |
Defined in Libjwt.RegisteredClaims | |
Encode Sub Source # | |
Defined in Libjwt.RegisteredClaims | |
Encode Iss Source # | |
Defined in Libjwt.RegisteredClaims | |
(ClaimEncoder a, KnownSymbol name, KnownNamespace ns, Encode (PrivateClaims tl ns)) => Encode (PrivateClaims ((name ->> a) ': tl) ns) Source # | |
Defined in Libjwt.PrivateClaims encode :: PrivateClaims ((name ->> a) ': tl) ns -> JwtT -> EncodeResult Source # | |
Encode (PrivateClaims Empty ns) Source # | |
Defined in Libjwt.PrivateClaims encode :: PrivateClaims Empty ns -> JwtT -> EncodeResult Source # | |
Encode (PrivateClaims pc ns) => Encode (Payload pc ns) Source # | |
Defined in Libjwt.Payload | |
Encode (PrivateClaims pc ns) => Encode (Jwt pc ns) Source # | |
Defined in Libjwt.Jwt |
class ClaimEncoder t where Source #
Low-level definition of JWT claims encoding.
encodeClaim :: String -> t -> JwtT -> EncodeResult Source #
Given a pointer to jwt_t, mutate the structure it points to to encode the value as a named claim It relies on the functions exported from Libjwt.FFI.Jwt to perform an impure effect of encoding
Instances
(EncoderDef a ~ ty, ClaimEncoder' ty a) => ClaimEncoder a Source # | |
Defined in Libjwt.Encoding encodeClaim :: String -> a -> JwtT -> EncodeResult Source # |
nullEncode :: b -> EncodeResult Source #
Do not perform any action. It is used to encode things like empty lists or Nothing