jwkEncode Create a JWS signed with a JWK. The key and algorithm must be consistent or an error will be returned.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulejose-jwt-0.10.0Haskell2010
JWS HMAC and RSA signed token support.
Example usage with HMAC:
import Jose.Jwsimport Jose.Jwalet Right (Jwt jwt) = hmacEncode HS256 "secretmackey" "public claims"jwt"eyJhbGciOiJIUzI1NiJ9.cHVibGljIGNsYWltcw.GDV7RdBrCYfCtFCZZGPy_sWry4GwfX3ckMywXUyxBsc"hmacDecode "wrongkey" jwtLeft BadSignaturehmacDecode "secretmackey" jwtRight (JwsHeader {jwsAlg = HS256, jwsTyp = Nothing, jwsCty = Nothing, jwsKid = Nothing},"public claims")
jwkEncode Create a JWS signed with a JWK. The key and algorithm must be consistent or an error will be returned.
hmacEncode :: JwsAlgThe MAC algorithm to use
-> ByteStringThe MAC key
-> ByteStringThe public JWT claims (token content)
-> Either JwtError JwtThe encoded JWS token
Create a JWS with an HMAC for validation.
hmacDecode :: ByteStringThe HMAC key
-> ByteStringThe JWS token to decode
-> Either JwtError JwsThe decoded token if successful
Decodes and validates an HMAC signed JWS.
rsaEncode :: MonadRandom m=> JwsAlgThe RSA algorithm to use
-> PrivateKeyThe key to sign with
-> ByteStringThe public JWT claims (token content)
-> m (Either JwtError Jwt)The encoded JWS token
Creates a JWS with an RSA signature.
rsaDecode :: PublicKeyThe key to check the signature with
-> ByteStringThe encoded JWS
-> Either JwtError JwsThe decoded token if successful
Decode and validate an RSA signed JWS.
ecDecode :: PublicKeyThe key to check the signature with
-> ByteStringThe encoded JWS
-> Either JwtError JwsThe decoded token if successful
Decode and validate an EC signed JWS