jwt_decode
Decode a JWT and optionally verify its HMAC signature, returning header, payload, algorithm, and signature verification status.
Instructions
Decode a JWT and (optionally) verify the HMAC signature.
Pure compute, no outbound network. When secret is provided we verify
HS256/HS384/HS512 signatures; without it we just decode and return the
header and payload. The original token is never logged.
Args:
token: Full JWT string (three dot-separated base64url segments)
secret: Optional HMAC secret. If supplied, signature_verified
will be True only if the signature matches.
Returns: dict with keys: header, payload, algorithm, signature_verified, valid
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | ||
| secret | No |