jwt

command module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 2 Imported by: 0

README

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"}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
io
jwt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL