decode
Analyse et affiche l’en-tête, les claims et la signature d’un JWT sans vérifier la signature. Pratique pour inspecter rapidement un token, que vous disposiez ou non de la clé de signature.
Par défaut, chaque champ d’en-tête/claim correspondant à un nom JWT enregistré (ex. alg, typ, iss, sub, exp) reçoit une courte description ajoutée en // commentaire en ligne, juste à côté de sa valeur. exp/nbf/iat reçoivent aussi une date lisible et un décalage relatif (« il y a 2 jours »). Si le token possède un claim exp ou nbf, un statut d’une ligne est affiché après la signature indiquant si le token est actuellement expiré, pas encore valide, ou valide.
Utilisation
Section titled “Utilisation”jwtop decode <token>echo <token> | jwtop decodejwtop find --file page.html | jwtop decodejwtop decode --raw <token>Options
Section titled “Options”| Option | Description |
|---|---|
--raw | N’affiche que le JSON brut et valide de l’en-tête/des claims/de la signature, sans description en ligne ni statut d’expiration. Pratique pour un pipe vers jq ou un autre outil. |
Exemple
Section titled “Exemple”jwtop decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8USortie :
Header:{ "alg": "HS256", // Algorithm — how the token is signed (or "none") "typ": "JWT" // Type — media type of the token, typically "JWT"}
Claims:{ "sub": "1234567890" // Subject — the principal the token is about}
Signature:dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8UAvec --raw, le même token affiche à la place du JSON brut et valide, sans commentaires ni statut d’expiration :
jwtop decode --raw eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8UHeader:{ "alg": "HS256", "typ": "JWT"}
Claims:{ "sub": "1234567890"}
Signature:dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8ULa commande retourne 1 si le token est structurellement malformé (pas un JWT valide).