package jwto
JWT encoding, decoding and verification
Install
Dune Dependency
Authors
Maintainers
Sources
0.2.0.tar.gz
md5=0d79373ce2262958c83eeae5e142150e
sha512=06b0cb3badadcc3e5650ae3279ec07fb6f110eacf5b82b6420e6d8f434dc00bf5cf2ae1f0baee2d924811062d4218e9b23a0f9af72ab2ac3a6357d886bcf4620
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)"
>