package jwto
JWT encoding, decoding and verification
Install
Dune Dependency
Authors
Maintainers
Sources
0.1.5.tar.gz
md5=9e3dacf9428266df7c37376ae4ebf4dd
sha512=82da5a4a06c9716396cfad274f708d1f6b4639a9789dae9c95a16a66aed9c095bca6497c659abb2e95a8761251932855e6688f696793e8843c7b7c559d2beda1
README.md.html
Ocaml JWT
Create a token
A payload is a list of tuples (string, string)
:
let payload =
[
("user", "sam);
("age", "17");
]
Jwt.make Jwt.HS256 "secret" payload
Jwt.make
returns a signed token (type Jwt.t):
{
header = ...;
payload = [...];
signature = ...;
}
Encode token
Jwt.encode Jwt.HS256 "secret" payload
-->
"eyJhbGciOiJIUzI1NiJ9...."
Decode token
Just decode the token, doesn't verify.
Jwt.decode "eyJhbGciOiJIUzI1NiJ9...."
-->
Ok { header = ...; payload = [...]; signature = ... }
Decode and verify
Verify and decode. If the verification fails you will get an Error
.
Jwt.decode_and_verify "secret" "eyJhbGciOiJIUzI1NiJ9...."
-->
Ok { header = ...; payload = [...]; signature = ... }
Verify only
Jwt.is_valid "secet" "eyJhbGciOiJIUzI1NiJ9...."
-->
true
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>