hansallis/elm-jwt/1.0.0

NOTE: the latest version is 1.2.0

JWT

JWT

type JWT
= JWS JWS

A JSON Web Token.

Can be either a JWS (signed) or a JWE (encrypted). The latter is not yet implemented.

= TokenTypeUnknown
| JWSError DecodeError

A structured error describing exactly how the decoder failed.

fromString : String -> Result DecodeError JWT

Decode a JWT from string.

fromString "eyJhbGciOi..." == Ok ...
fromString "" == Err ...
fromString "definitelyNotAJWT" == Err ...

Verification

= JWSVerificationError VerificationError

A structured error describing all verification errors.

VerifyOptions
-> String
-> Posix
-> JWT
-> Result VerificationError Bool

Check if the token is valid.

VerifyOptions
-> String
-> JWT
-> Task Never (Result VerificationError Bool)

A task to check if the token is valid.