jwtcli π
A tiny CLI to pretty-print JSON Web Tokens (JWTs).
Decodes and formats header and payload. Additionally annotates standard time-based claims (iat, nbf, exp) with human-readable timestamps in your local timezone.
Installation π¦
Build from source ποΈ
Clone and build:
git clone https://github.com/floj/jwtcli.git
cd jwtcli
./build.sh
The resulting binary will be ./jwtcli (or ./jwtcli.exe on Windows).
Go install π
go install github.com/floj/jwtcli@latest
This places jwtcli in your GOBIN (usually ~/go/bin). Ensure it is on your PATH.
Usage π§
You can pass a JWT via arguments or pipe it via stdin.
From arguments π¬
jwtcli <jwt1> [<jwt2> ...]
From stdin π₯
echo "$JWT" | jwtcli
# or
cat tokens.txt | jwtcli
Examples π§ͺ
jwtcli eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0IiwiaWF0IjoxNzAwMDAwMDB9.signature
Output:
{
"alg": "HS256",
"typ": "JWT"
}
{
"iat": 170000000,
"sub": "1234"
}
// iat: 1975-05-22 15:13:20 +0100 CET
Build script π οΈ
./build.sh builds a statically linked binary.
./build.sh
Development π§βπ»
# Run directly
go run ./
# Build
go build ./
License π
MIT, see LICENSE.