GitXplorerGitXplorer
M

jwt-decode

public
1 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
43a627b1d8832d0a1292849b4ffe640f7f26f44e

Merge pull request #1 from MarcusGrass/validate-actions

MMarcusGrass committed 5 months ago
Verified
ac23ab2780ed8db8c2e835308a2b1168009ac69f

Cached install fuzzer

MMarcusGrass committed 5 months ago
Verified
a208e010c1d7d36a181de731bcacfbeb47ec408f

Try run fuzzer

MMarcusGrass committed 5 months ago
Verified
8c9903b3366114f94b4564e51e451498148cb0bd

Fixup readme

MMarcusGrass committed 5 months ago
Verified
baea3d1eda8c5a6b249f710c53774c2e1d4b5d8f

Cleaned up repo

MMarcusGrass committed 5 months ago

README

The README file for this repository.

Jwt decode

A tiny cli for decoding JWTs (specifically the JWS kind).

Why?

I have found myself having to look to see what's inside a JWT many times, I do think jwt.io is trustworthy, but I'm too paranoid to use it.

I just want a CLI where I can examine my JWTs locally, that's why I made this.

You could also check stackoverflow, and really, I could have just aliased that monster of an expression, but I thought this was a bit more fun.

Features

Decode a jwt as an arg showing relative time

jwt-decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNzI0OTUyOTQwLCJuYmYiOjE3MjQ5NTI5NTAsImV4cCI6MTcyNDk5Mjk0MH0.ZrQSkD_tzm7yyTC0Cw3_qmBRZhi0QCirL4hfICAWNr0 -v -r
# Outputs:
# Header {
#   "alg": "HS256",
#   "typ": "JWT"
# }
# Payload {
#   "exp": "1724992940 [2024-08-30 4:42:20.0 +00:00:00 (In 39843 seconds)]",
#   "iat": "1724952940 [2024-08-29 17:35:40.0 +00:00:00 (157 seconds ago)]",
#   "name": "John Doe",
#   "nbf": "1724952950 [2024-08-29 17:35:50.0 +00:00:00 (147 seconds ago)]",
#   "sub": "1234567890"
# }

Or just as an arg without time

jwt-decode -v eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI3Nzc3NyIsIm5hbWUiOiJNeSB0ZXN0IG5hbWUiLCJpYXQiOjE1MTYyMzkwMzl9.r0YSbk-Gjr4gWATqbDnirs102IUBQRru-_TNu5AtE18
# Outputs:
# Header {
#   "alg": "HS256",
#   "typ": "JWT"
# }
# Payload {
#   "iat": 1516239039,
#   "name": "My test name",
#   "sub": "77777"
# }

Or piped

echo eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI3Nzc3NyIsIm5hbWUiOiJNeSB0ZXN0IG5hbWUiLCJpYXQiOjE1MTYyMzkwMzl9.r0YSbk-Gjr4gWATqbDnirs102IUBQRru-_TNu5AtE18 | jwt-decode -v
# Same output as above

Or from a file

jwt-decode -v -p ./.local/data/test.jwt
# Same output as above

Output only the header

jwt-decode -p ./.local/data/test.jwt -o header
# Output: 
# {
#   "alg": "HS256",
#   "typ": "JWT"
# }

Or the payload

jwt-decode -p ./.local/data/test.jwt -o payload
# Output: 
# {
#   "iat": 1516239039,
#   "name": "My test name",
#   "sub": "77777"
# }

License

Licensed under GPL-3.0