Giter Site home page Giter Site logo

tokenize's Introduction

Tokenize

A command line tool for developing and working with JSON web tokens.

Requirements

tokenize is written in Elixir and will require Elixir > 1.11.

Installation

Start by cloning the repo at https://github.com/cmmorrow/tokenize.

To install tokenize locally:

  • Run mix deps.get; mix escript.build from the command line to install dependencies and create the tokenize binary.
  • Verify tokenize is installed properly by running ./tokenize with no arguments.

To install tokenize with Docker:

  • Run docker build -t tokenize .
  • Verify tokenize is installed properly by running docker run -it --rm tokenize with no arguments.

Usage

Generate a JWT with an arbitrary private claims payload and default secret of tokenize:

./tokenize '{"some": "data"}'

Specify a secret:

./tokenize --secret mysecret '{"some": "data"}'

Important: Specifying an HMAC secret from the command line is not considered secure and tokenize should not be used in a production environment. Use tokenize for developing and manually working with JWTs only. Likewise, verifying a signature using a private key (for RSA and EC algorithms) from the command line should be handled with care.

Specify a different algorithm (the default is HMAC 256):

./tokenize --algorithm HS512 '{"some": "data"}'

Provide public claims:

./tokenize --iss tokenize --aud developers --iat 1625636467

Provide public and private claims:

./tokenize --iss tokenize --aud developers --iat 1625636467 '{"some": "data"}'

Verify a token's signature:

./tokenize --secret mysecret --verify eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJoZWxsbyI6IndvcmxkIn0.YhmYBi-AxvPdMDQwC7jAU8uJuvFk9SUWqP3Ermk2g_Q

Create a token from a JSON file:

cat data.JSON | jq -c | xargs -0 ./tokenize --secret mysecret

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.