npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jwt-generate

v1.0.0

Published

Generate a 'JSON Web Token' (JWT).

Readme

jwt-generate

Codacy Badge codebeat badge dependencies Status

Generate a JSON Web Token - JWT

Table of Contents

CLI

npm install -g jwt-generate

Commands

jwt-generate <command>

Commands:
  jwt-generate generate      Generates a JWT.
  jwt-generate decode <jwt>  Decodes a JWT.

Options:
  --version  Show version number                         [boolean]
  --help     Show help                                   [boolean]

Generate

jwt-generate generate

Generates a JWT. Either 'secret' or 'secretFile' must be supplied.

Options:
  --version         Show version number                                 [boolean]
  --help            Show help                                           [boolean]
  --secret, -s      JWT secret string.
  --secretFile, -f  File path containing the JWT Secret.
  --algorithm, -a   Choices: "RS256", "HS256".                          [string] [default: "HS256"]
  --expire, --exp   How long in seconds until the JWT should expire.    [number]
  --claims          JWT claims.

Decode

jwt-generate decode <jwt>

Decodes a JWT.

Options:
  --version  Show version number                         [boolean]
  --help     Show help                                   [boolean]

CLI Examples

Generates a JWT signed with the secret 'my-secret' using the HS256 algorithm.

jwt-generate generate --secret my-secret

{
  "headers": {
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzOTIsImV4cCI6MTUyMDAyOTk5Mn0.5TkR3nHlPA2LJhe8jGxE26AnkeCkfFeVrJN5FdOUPew"
  },
  "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzOTIsImV4cCI6MTUyMDAyOTk5Mn0.5TkR3nHlPA2LJhe8jGxE26AnkeCkfFeVrJN5FdOUPew"
}

Generates a JWT signed with private key file 'private_key.pem' using the HS256 algorithm.

jwt-generate generate --secretFile private_key.pem

{
  "headers": {
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzODAsImV4cCI6MTUyMDAyOTk4MH0.19sUG-ncAycxdosaZJDGpkeSfuugmEH_fCPRJtTsOI4"
  },
  "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzODAsImV4cCI6MTUyMDAyOTk4MH0.19sUG-ncAycxdosaZJDGpkeSfuugmEH_fCPRJtTsOI4"
}

Generates a JWT signed with private key file 'private_key.pem' using the RS256 algorithm.

jwt-generate generate -f private_key.pem -a RS256

{
  "headers": {
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzNTIsImV4cCI6MTUyMDAyOTk1Mn0.AkPpR5BASPD4qY-y_RIkVuaRNTnnA4VCyq7qRPd7nwsbdRGifDlRVJi0RoxyzFAWBkgskTJJK3Zb8v_AF16yp8QkNx00SvTMGOYueFjk2cWxCOneJyJ14K4huflTvqmky5VTpI6Bv5l6ezrpZaWVM9bmpbqI-_QC6A74mFkC5T45WRPXx0K14YCL2lW8UelnRFb8b3y9CdOA088wU4fShLHQvzPS0lzH-WXjfHl5_Dt7AjV8Bwim1sJS1yZudebKV3qEnO9nd4OhMlTeFH2vxevPumtlmmqCf6e5K59x27KcIu7tfkRK81WjX1HP-UiD-p0rpcney3oBDMHcjwIqZQ"
  },
  "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1MjAwMjYzNTIsImV4cCI6MTUyMDAyOTk1Mn0.AkPpR5BASPD4qY-y_RIkVuaRNTnnA4VCyq7qRPd7nwsbdRGifDlRVJi0RoxyzFAWBkgskTJJK3Zb8v_AF16yp8QkNx00SvTMGOYueFjk2cWxCOneJyJ14K4huflTvqmky5VTpI6Bv5l6ezrpZaWVM9bmpbqI-_QC6A74mFkC5T45WRPXx0K14YCL2lW8UelnRFb8b3y9CdOA088wU4fShLHQvzPS0lzH-WXjfHl5_Dt7AjV8Bwim1sJS1yZudebKV3qEnO9nd4OhMlTeFH2vxevPumtlmmqCf6e5K59x27KcIu7tfkRK81WjX1HP-UiD-p0rpcney3oBDMHcjwIqZQ"
}

Outputs the decoded JWT in JSON format.

jwt-generate decode eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MjAwMjYyOTAsImV4cCI6MTUyMDAyOTg5MH0.lUGQ7n3QTWGLrH-KcMkCWsGlMWxO-QodOEdbGSeZF-A

{
  "header": {
    "typ": "JWT",
    "alg": "HS256"
  },
  "payload": {
    "iat": 1520026290,
    "exp": 1520029890
  },
  "signature": "lUGQ7n3QTWGLrH-KcMkCWsGlMWxO-QodOEdbGSeZF-A"
}