By Thomas Bhatia (thomas.bhatia@eo.io)
A light and compact yet fully IETF RFC 7518 compliant JSON Web Token (JWT) library for Erlang.
Supports the following algorithms:
- HMAC with SHA-2
- HS256
- HS384
- HS512
- RSA PKCS1-v1_5 rsassa_pkcs1_sign / rsassa_pkcs1_verify
- RS256
- RS384
- RS512
- ECDSA rsaes_pkcs1_encrypt / rsaes_pkcs1_verify
- ES256 - secp256r1
- ES384 - secp384r1
- ES512 - secp512r1
Add JWTe to your rebar.config
dependencies:
{deps, [
{jwte,{git , "git@github.com:thomasbhatia/jwte.git", {tag, "v0.5.0"}}}
]}.
jwte:encode(#{foo => bar}, Key).
Decode payload with verification
jwte:decode(<<"XXXX">>, Key).
Decode without verifying the payload
jwte:peek(<<"XXXX">>).