
# Safety

> Handle what goes wrong, check what a token claims, and know the bounds every call works within.

Every token, key and session function in unjwt throws one kind of error when something goes wrong: a `JWTError` with a short `code` your code can branch on. Claims are checked by default, so an expired token never verifies unless you say so. And the work one token can make your server do is bounded: when a token asks for more, the call refuses it instead of trying harder.

::card-group
::card{title="Handle errors" icon="i-lucide-circle-alert" to="/safety/errors"}
Catch `JWTError`, tell a bad token from a bug on your side by its code, and answer each one.
::
::card{title="Validate claims" icon="i-lucide-badge-check" to="/safety/claims"}
Check issuer, audience, subject, age and type, and write `iat`, `exp` and `nbf` when you sign.
::
::card{title="Limits" icon="i-lucide-gauge" to="/safety/limits"}
The bounds on signatures, recipients, key trials and password work, and when to raise one.
::
::card{title="Utilities" icon="i-lucide-wrench" to="/safety/utils"}
Strict base64url, secure random bytes, and type guards for keys and key sets.
::
::
