Skip to content

dandehoon/jwtd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jwtd

CI

A simple command-line JSON Web Tokens decoder tool.

Functionality

  • Accepts JWT tokens via command-line arguments or standard input
  • Cleans tokens (removes Bearer prefix, whitespace, newlines)
  • Formats timestamps (exp, nbf, iat) as human-readable dates

Installation

Option 1: Homebrew (Recommended)

brew tap dandehoon/tools
brew install jwtd

Note: Works on macOS and Linux (with Homebrew/Linuxbrew)

Option 2: Quick Install

Download and install the latest release directly from GitHub:

curl -sSL https://raw.githubusercontent.com/dandehoon/jwtd/main/install.sh | sudo bash

Option 3: Install with Go

If you have Go installed:

go install github.com/dandehoon/jwtd@latest

Option 4: Download Binary Manually

  1. Go to the releases page
  2. Download the appropriate binary for your platform
  3. Make it executable and move it to a directory in your PATH

How to Use

  1. Use the tool: You can provide the JWT token in two ways:

    Method 1: Command-line argument (Direct)

    Pass the JWT token directly as a command-line argument:

    jwtd "your.jwt.token"

    The tool accepts tokens in various formats:

    # Standard JWT token
    jwtd "your.jwt.token"
    
    # With Bearer prefix
    jwtd "Bearer your.jwt.token"
    
    # With any custom prefix, extra spaces, or newlines
    jwtd "  JWT   your.jwt.token  "

    Method 2: Pipe input (Standard input)

    Pipe the JWT into the program via standard input:

    echo "your.jwt.token" | jwtd

    The tool accepts tokens in various formats:

    # Standard JWT token
    echo "your.jwt.token" | jwtd
    
    # With Bearer prefix
    echo "Bearer your.jwt.token" | jwtd
    
    # With any custom prefix, extra spaces, or newlines
    echo "  JWT   your.jwt.token  " | jwtd

    Tip for macOS users: You can use pbpaste to pipe the content of your clipboard directly:

    pbpaste | jwtd

    Examples:

    Using command-line argument:

    jwtd "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

    Using pipe input:

    echo "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" | jwtd

    Both methods will output:

    alg: HS256
    typ: JWT
    ---
    iat: 1516239022 (2018-01-18T01:30:22Z)
    name: John Doe
    sub: 1234567890
    

Building from Source

If you prefer to build from source:

go build -o jwtd main.go

Then you can run it using ./jwtd.

Homebrew Tap Development

Testing the Homebrew formula:

make test-brew

This will audit the formula and test installation.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published