Security & Identity · zero-dependency · MIT

larzjwt

Signed JSON tokens, header.payload.signature.

Real HMAC-SHA256-signed tokens, base64url-encoded, in the exact three-part shape every JWT library produces - built from crypto.hmac_bytes, json and base64, not a reimplementation of the crypto underneath. verify() throws on a bad signature, it never silently returns a tampered payload.

larzscript pkg install jwt
View on GitHub →Learn the stack

What you get

Try it

import "jwt" as jwt
let token = jwt.sign({"sub": "user1", "role": "admin"}, "secret")
print(token)
let payload = jwt.verify(token, "secret")
print(payload)
try { jwt.verify(token, "wrong-secret") } catch e { print("tampered/wrong secret rejected:", e["type"]) }
Output
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMSIsInJvbGUiOiJhZG1pbiJ9.Q_itbUhr_nzEloB19Hi8GokifwK35c-L-zFrIM-W9w
{sub: user1, role: admin}
tampered/wrong secret rejected: JwtError

Why it's in the Larz Stack

larzjwt is a real Larzscript package (larzscript pkg install jwt) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.