| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
| Extensions |
|
Libjwt.Encoding
Description
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.
Instances
class ClaimEncoder t where Source #
Low-level definition of JWT claims encoding.
Methods
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 Methods 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