Skip to content
pete911Public

About

jwt cli

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

Repository files navigation

jwt

pipeline

jwt cli to decode and encode jwt tokens

download

build/install

brew

  • add tap brew tap pete911/tap
  • install brew install jwt

go

  • install go
  • build make build
  • install make install

release

Releases are published when the new tag is created e.g. git tag -m "add super cool feature" v1.0.0 && git push --follow-tags

usage

decode

Usage:
  jwt decode [flags] [token]

Flags:
      --alg string   algorithm for signature validation, if it is empty, no validation is done
  -h, --help         help for decode
      --indent       indent output
      --key string   key to validate token

Global Flags:
      --silent   suppress logs (warn, debug, ...)

Example

jwt decode --key hello --alg HS256 eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.ElsKKULlzGtesThefMuj2_a6KIY9L5i2zDrBLHV-e0M
valid: true, header: {"alg":"HS256","typ":"JWT"}, claims: {"iat":1516239022,"name":"John Doe","sub":"1234567890"}

encode

Usage:
  jwt encode [flags] [claims]

Flags:
      --alg string   algorithm for signature validation, if it is empty, no validation is done
  -h, --help         help for encode
      --key string   key to validate token

Global Flags:
      --silent   suppress logs (warn, debug, ...)

Example

jwt encode --key hello --alg HS256 '{"hello":"ok"}'
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJoZWxsbyI6Im9rIn0.ycJ6FlOpr9qbWVQsVqQr9Pls1F_QfoOE7fk9pUvYNm8

encode/decode stdin

Input can be read from stdin instead of passed as an argument as well.

jwt encode --key hello --alg HS256 '{"hello":"ok"}' | jwt decode --key hello --alg HS256
valid: true, header: {"alg":"HS256","typ":"JWT"}, claims: {"hello":"ok"}

About

jwt cli

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages