jwto

JWT encoding, decoding and verification
README

Create a token

A payload is a list of tuples (string, string):

let payload =
  [
    ("user", "sam);
    ("age", "17");
  ]

Jwto.make Jwto.HS256 "secret" payload

Jwto.make returns a signed token (type Jwto.t):

{
  header = ...;
  payload = [...]; 
  signature = ...;
}

Encode token

Jwto.encode Jwto.HS256 "secret" payload

-->

"eyJhbGciOiJIUzI1NiJ9...."

Decode token

Just decode the token, doesn't verify.

Jwto.decode "eyJhbGciOiJIUzI1NiJ9...."

-->

Ok { header = ...; payload = [...]; signature = ... }	

Decode and verify

Verify and decode. If the verification fails you will get an Error.

Jwto.decode_and_verify "secret" "eyJhbGciOiJIUzI1NiJ9...."

-->

Ok { header = ...; payload = [...]; signature = ... }

Verify only

Jwto.is_valid "secet" "eyJhbGciOiJIUzI1NiJ9...."

-->

true
Install
Sources
0.3.0.tar.gz
md5=cc238a4a7d319d37579a930912a68d04
sha512=cd89bc9d2fedc483329ca328fd8895bd49b24f171d8cef27fe34a28612cbbdc88eff7babc810c7967c310aa8056fdfef08bf0693c27e6541a649507b8c7963bb
Dependencies
re
>= "1.8"
base64
>= "3.1"
yojson
>= "1.6"
fmt
>= "0.8"
cryptokit
>= "1.10"
alcotest
with-test
dune
>= "1.7"
ocaml
>= "4.05"
Reverse Dependencies
sihl
< "0.2.0" | >= "0.3.0~rc2"