Skip to content

Instantly share code, notes, and snippets.

@matiferrigno
Last active September 21, 2023 15:56
Show Gist options
  • Save matiferrigno/11ecf55b3f064abb210d226e9cfe29de to your computer and use it in GitHub Desktop.
Save matiferrigno/11ecf55b3f064abb210d226e9cfe29de to your computer and use it in GitHub Desktop.
# ~/.jq/jwt.jq
#
# Ex.
# jq -R 'import "jwt" as jwt; jwt::decode' /tmp/jwt_to_decode
#
# this is a alternative to:
# jq -R 'split(".") | .[0],.[1] | @base64d | fromjson' /tmp/jwt_to_decode
#
# still possible to use an alias for either command but this appears to be more scalable.
def decode:
split(".")
| .[0],.[1]
| @base64d
| fromjson
;
@chrodriguez
Copy link

Ahh, muy bueno!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment