Helper functions for working with Jwt tokens
All the token parsing goodness in the form of a Json Decoder
firebaseToken =
Json.Decode.decodeString (tokenDecoder Jwt.Decoders.firebase) tokenStringChecks a token for Expiry (used the "exp" field). Returns expiry or any error that occurred in processing.
Extracts the token expiration timestamp from the JWT "exp" field. Returns the timestamp in milliseconds since epoch, or any error that occurred while processing the token.
Checks whether a token has expired, and returns True or False, or any error that occurred while processing the token.
Returns stringified json of the token's header
The following errors are modeled
TokenProcessingError - something wrong with the the raw token (e.g. length, base64 encoding)TokenDecodeError - the token is not valid JSON or the decoder provided could not decode the bodyTokenHeaderError - the header is corrupted in some wayProvides a default conversion of a JwtError to a string
Parses the token, checking that it meets the Jwt standards. In the event of success,
decodeTokenreturns result of the JSON Decoder.