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
What you get
- Real HS256 signing, standard 3-part token shape
- base64url encoding, no padding
- verify() throws on a bad signature - never silent
- Built on crypto/json/base64, not reinvented
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: JwtErrorWhy 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.