{"repo":"tekul/jose-jwt","free":true,"listed":false,"github":"https://github.com/tekul/jose-jwt","clone":"git clone https://github.com/tekul/jose-jwt.git","description":"Haskell implementation of JOSE/JWT standards","language":"Haskell","stars":38,"topics":["jwt","jose","jws","jwe","haskell"],"license":"BSD-3-Clause","category":"auth-billing-email","readme_excerpt":"jose-jwt A Haskell implementation of the JSON Object Signing and Encryption (JOSE) specifications and the related JWT specification, as used, for example, in OpenID Connect. Background The JWT specification was split into JWS and JWE during its development so does not contain much. A JWT is either a JWS or a JWE depending on whether it is signed or encrypted. It is encoded as a sequence of base64 strings separated by '.' characters [1]. Technically, the content of a JWT should be JSON (unless it's a nested JWT), but this library doesn't care - it only requires a bytestring. The application should verify that the content is valid. Exactly what that means will depend on what you are using JWTs for. Examples You can either use the high-level encode and decode functions in the Jwt module or specific functions in the Jws and Jwe modules. The following examples can be entered directly into ghci . Use :set -XOverloadedStrings to begin with. JWS signing example with a symmetric HMAC algorithm HMAC is a good choice when both signer and verifier have a copy of the key. import Jose.Jws (hmacEncode, hmacDecode) import Jose.Jwa (JwsAlg(HS256)) hmacEncode HS256 \"aRANDOMlygeneratedkey\" \"my JSON message\" Right (Jwt {unJwt = \"eyJhbGciOiJIUzI1NiJ9.bXkgSlNPTiBtZXNzYWdl.lTJx7ECLwYF3P7WbrrUpcp 2SdLiFXaDwK-PXcipt5Q\"}) hmacDecode \"aRANDOMlygeneratedkey\" \"eyJhbGciOiJIUzI1NiJ9.bXkgSlNPTiBtZXNzYWdl.lTJx7ECLwYF3P7WbrrUpcp 2SdLiFXaDwK-PXcipt5Q\" Right (JwsHeader {jwsAlg = HS256, jwsTyp = Nothing, jwsCty ","default_branch":null,"files":null,"tree":[],"storefront":"/r/tekul","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/tekul/jose-jwt/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}