-
-
Save bitsapien/3b9e6986734abdfe827b789eb8615c67 to your computer and use it in GitHub Desktop.
Offline tooling inspired by https://www.jvt.me/posts/2020/09/01/against-online-tooling/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const jwtDecode = (jwt) => console.log(Buffer.from((process.argv.slice(2)[0]).split(".")[1], "base64").toString("utf-8")); | |
jwt = process.argv.slice(2)[0] | |
jwtDecode(jwt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# jwt decode from clipboard | |
djwt() { | |
jwt `pbpaste` | python -m json.tool | bat -p -ljson | |
# Put the below nodejs script in your path to make the above work. | |
} | |
# print json from clipboard | |
djson() { | |
pbpaste | python -m json.tool | bat -p -ljson | |
} | |
# Usage | |
$ djwt | |
{ | |
"iat": 1516239022, | |
"name": "John Doe", | |
"sub": "1234567890" | |
} | |
$ djson | |
{ | |
"salt": 1099157286, | |
"therefore": -1336451396 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment