Last active
June 19, 2022 15:46
-
-
Save patro85/2a76d16181730989b9b9af6a7ca6cd1e to your computer and use it in GitHub Desktop.
A BBEdit Text Filter script to take textual input and produce decode of JWT tokens.
This file contains hidden or 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
#!/bin/bash | |
# | |
# JWT Decode | |
# https://gist.github.com/patro85/2a76d16181730989b9b9af6a7ca6cd1e | |
# | |
# A BBEdit Text Filter script to take textual input and produce decode of JWT tokens. | |
# Note: Signature section is ignored. Meant to be used in conjunction with a separate JSON | |
# formatter. | |
# | |
# Installation instructions: Place this file in BBEdit's "Text Filters" folder inside of | |
# "Application Support" (which will live your ~/Library/, Dropbox, or iCloud Drive) | |
# | |
# See https://www.bbeditextras.org/text-filters/ | |
# Patrick Mayo | |
# @_patrickmayo | |
# [email protected] | |
# April 22, 2022 | |
IN=$(tee) | |
HEADER="$(echo $IN | cut -d'.' -f1)" | |
PAYLOAD="$(echo $IN | cut -d'.' -f2)" | |
CMD1="$(echo -n "$HEADER" | base64 --decode)" | |
CMD2="$(echo -n "$PAYLOAD" | base64 --decode)" | |
OUT="$(echo -n "{\"header\":" && echo -n "$CMD1" && echo -n "}," && echo -n "\"payload\":" && echo -n "$CMD2" && echo -n "}")" | |
echo -n "${OUT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment