Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extensions |
|
JWT decoding definition
This module can be considered internal to the library
Users should never need to implement the Decode
typeclass or use any of the exported functions or types directly.
You'll only need to know of Decode
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
- newtype DecodeResult t = Result {
- getOptional :: JwtIO (Maybe t)
- hoistResult :: Maybe a -> DecodeResult a
- class ClaimDecoder t where
- decodeClaim :: String -> JwtT -> DecodeResult t
- class Decode c where
- getOrEmpty :: Monoid a => DecodeResult a -> JwtIO a
- decodeClaimOrThrow :: ClaimDecoder t => String -> proxy t -> JwtT -> JwtIO t
- decodeClaimProxied :: ClaimDecoder t => String -> proxy t -> JwtT -> DecodeResult t
- type family Decodable t :: Constraint where ...
- data JwtIO a
Documentation
newtype DecodeResult t Source #
Result | |
|
Instances
Monad DecodeResult Source # | |
Defined in Libjwt.Decoding (>>=) :: DecodeResult a -> (a -> DecodeResult b) -> DecodeResult b # (>>) :: DecodeResult a -> DecodeResult b -> DecodeResult b # return :: a -> DecodeResult a # | |
Functor DecodeResult Source # | |
Defined in Libjwt.Decoding fmap :: (a -> b) -> DecodeResult a -> DecodeResult b # (<$) :: a -> DecodeResult b -> DecodeResult a # | |
Applicative DecodeResult Source # | |
Defined in Libjwt.Decoding pure :: a -> DecodeResult a # (<*>) :: DecodeResult (a -> b) -> DecodeResult a -> DecodeResult b # liftA2 :: (a -> b -> c) -> DecodeResult a -> DecodeResult b -> DecodeResult c # (*>) :: DecodeResult a -> DecodeResult b -> DecodeResult b # (<*) :: DecodeResult a -> DecodeResult b -> DecodeResult a # | |
Alternative DecodeResult Source # | |
Defined in Libjwt.Decoding empty :: DecodeResult a # (<|>) :: DecodeResult a -> DecodeResult a -> DecodeResult a # some :: DecodeResult a -> DecodeResult [a] # many :: DecodeResult a -> DecodeResult [a] # |
hoistResult :: Maybe a -> DecodeResult a Source #
Lift pure value
class ClaimDecoder t where Source #
Low-level definition of claims decoding.
decodeClaim :: String -> JwtT -> DecodeResult t Source #
Given a pointer to jwt_t, try to decode the value of type t
Instances
(DecoderDef a ~ ty, ClaimDecoder' ty a) => ClaimDecoder a Source # | |
Defined in Libjwt.Decoding decodeClaim :: String -> JwtT -> DecodeResult a Source # |
Definition of claims decoding.
The only use for the user is probably to write a function that is polymorphic in the payload type
decode :: JwtT -> JwtIO c Source #
Construct an action that decodes the value of type c
, given a pointer to jwt_t. The action may fail.
Instances
Decode Header Source # | |
Decode Typ Source # | |
Decode Alg Source # | |
Decode Jti Source # | |
Decode Iat Source # | |
Decode Nbf Source # | |
Decode Exp Source # | |
Decode Aud Source # | |
Decode Sub Source # | |
Decode Iss Source # | |
(ty ~ DecodeAuxDef a, DecodeAux ty ns name a, CanAdd name tl, Decode (PrivateClaims tl ns)) => Decode (PrivateClaims ((name ->> a) ': tl) ns) Source # | |
Defined in Libjwt.PrivateClaims | |
Decode (PrivateClaims Empty ns) Source # | |
Defined in Libjwt.PrivateClaims | |
Decode (PrivateClaims pc ns) => Decode (Payload pc ns) Source # | |
getOrEmpty :: Monoid a => DecodeResult a -> JwtIO a Source #
Action that returns mempty
if decoding has failed
decodeClaimOrThrow :: ClaimDecoder t => String -> proxy t -> JwtT -> JwtIO t Source #
Action that throws MissingClaim
if decoding has failed
decodeClaimProxied :: ClaimDecoder t => String -> proxy t -> JwtT -> DecodeResult t Source #
decodeClaim
through proxy
type family Decodable t :: Constraint where ... Source #
Decodable t = ClaimDecoder' (DecoderDef t) t |