Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Jwt
- type Jwe = (JweHeader, ByteString)
- type Jws = (JwsHeader, ByteString)
- data JwtClaims = JwtClaims {}
- data JwsHeader = JwsHeader {}
- data JweHeader = JweHeader {}
- data JwtError
- decode :: CPRG g => g -> [Jwk] -> ByteString -> (Either JwtError Jwt, g)
- decodeClaims :: ByteString -> Either JwtError (JwtHeader, JwtClaims)
Documentation
type Jwe = (JweHeader, ByteString) Source
The header and claims of a decoded JWE.
type Jws = (JwsHeader, ByteString) Source
The header and claims of a decoded JWS.
Registered claims defined in section 4 of the JWT spec.
Header content for a JWS.
Header content for a JWE.
Decoding errors.
KeyError Text | No suitable key or wrong key type |
BadAlgorithm Text | The supplied algorithm is invalid |
BadDots Int | Wrong number of "." characters in the JWT |
BadHeader | Header couldn't be decoded or contains bad data |
BadClaims | Claims part couldn't be decoded or contains bad data |
BadSignature | Signature is invalid |
BadCrypto | A cryptographic operation failed |
Base64Error String | A base64 decoding error |
:: CPRG g | |
=> g | |
-> [Jwk] | The keys to use for decoding |
-> ByteString | The encoded JWT |
-> (Either JwtError Jwt, g) | The decoded JWT, if successful |
Uses the supplied keys to decode a JWT.
Locates a matching key by header kid
value where possible
or by suitable key type.
The JWK use
and alg
options are currently ignored.
decodeClaims :: ByteString -> Either JwtError (JwtHeader, JwtClaims) Source
Convenience function to return the claims contained in a JWT. This is required in situations such as client assertion authentication, where the contents of the JWT may be required in order to work out which key should be used to verify the token. Obviously this should not be used by itself to decode a token since no integrity checking is done and the contents may be forged.