HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Modulejose-jwt-0.11.0Haskell2010

Jose.Jws

JWS HMAC and RSA signed token support.

Example usage with HMAC:

Example6 expressions
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")
  • 10 values
  • Packagejose-jwt-0.11.0
  • Exports10
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceJws.hs
valuejwkEncode
  1. :: MonadRandom m
  2. => JwsAlg

    The algorithm to use

  3. -> Jwk

    The key to sign with

  4. -> Payload

    The public JWT claims

  5. -> m (Either JwtError Jwt)

    The encoded token, if successful

#

Create a JWS signed with a JWK. The key and algorithm must be consistent or an error will be returned.