package jwto
JWT encoding, decoding and verification
Install
Dune Dependency
Authors
Maintainers
Sources
0.2.1.tar.gz
md5=8812b0b700b58ce7b8c885c461878f80
sha512=13b61cb5412689f33f6ae0fd3908aeb2c2e12a0d75477ffe17ab966c79e65da577d998c489cc4f0ff159499ea662bf901487858d90592a3782b21c23be65bd1c
README.md.html
Ocaml JWT
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
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>