1.1.0 • Published 1 year ago

jwter v1.1.0

Weekly downloads
-
License
GNU General Publi...
Repository
github
Last release
1 year ago

Table of Contents

About The Project

JWTLogo

I created this tool to help me learn more about JWTs and to make it easier to decode, sign and verify JWTs. I also wanted to create a tool that I could use in my day to day work.

(Icon by GOWI)

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Install the package globally with:

npm i -g jwter

Then run the command to generate a secret:

jwter sign top_secret '{"name": "Jack"}'

Usage

There are many subcommands which can be used to decode, sign and verify JWTs.

Decode

To decode a JWT, use the decode command:

jwter decode <token>

It will then output the decoded JWT in the following format:

* Header:
{
  "alg": "HS256",
  "typ": "JWT"
}
* Payload:
{
    "test": "test",
    "iat": 1672777260
}

Sign

To sign a JWT, use the sign command:

jwter sign <secret> <data>

The secret should be a string and the data should be a JSON string.

There are many options that can be used with the sign command:

  • -a or --algorithm - The algorithm to use to sign the JWT. Defaults to HS256.
  • -e or --expiresIn - The time in seconds until the token expires.
  • -s or --sub - The subject of the token.
  • -i or --iss - The issuer of the token.
  • -aud or --audience - The audience of the token.

Each one will be added to the payload of the JWT.

Verify

To verify a JWT, use the verify command:

jwter verify <secret> <token>

The secret should be a string and the data should be a JSON string.

There are many options that can be used with the verify command. These options will be used to verify the JWT:

  • -d or --decode - Decodes the JWT after verifying it.
  • -ie or --ignore-exp - Ignores the expiry of the JWT.
  • -s or --sub - The subject of the token.
  • -i or --iss - The issuer of the token.
  • -a or --audience - The audience of the token.

For more help type:

jwter --help

Releases

See the releases page for all releases and to download the binaries.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU General Public License v3.0 License. See LICENSE for more information.

Contact

Jack Humphries - me@jackhumphries.io

Project Link: https://github.com/JackHumphries9/jwter