Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pete911/jwt
jwt cli
https://github.com/pete911/jwt
go golang jwt jwt-cli jwt-token
Last synced: about 2 months ago
JSON representation
jwt cli
- Host: GitHub
- URL: https://github.com/pete911/jwt
- Owner: pete911
- License: mit
- Created: 2021-09-02T16:16:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-17T06:58:13.000Z (6 months ago)
- Last Synced: 2024-06-20T10:19:54.646Z (6 months ago)
- Topics: go, golang, jwt, jwt-cli, jwt-token
- Language: Go
- Homepage:
- Size: 1.76 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jwt
[![pipeline](https://github.com/pete911/jwt/actions/workflows/pipeline.yml/badge.svg)](https://github.com/pete911/jwt/actions/workflows/pipeline.yml)
jwt cli to decode and encode jwt tokens
## download
- [binary](https://github.com/pete911/jwt/releases)
## build/install
### brew
- add tap `brew tap pete911/tap`
- install `brew install jwt`### go
- install [go](https://golang.org/doc/install)
- 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 tokenGlobal Flags:
--silent suppress logs (warn, debug, ...)
```Example
```shell
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 tokenGlobal Flags:
--silent suppress logs (warn, debug, ...)
```Example
```shell
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.```shell
jwt encode --key hello --alg HS256 '{"hello":"ok"}' | jwt decode --key hello --alg HS256
valid: true, header: {"alg":"HS256","typ":"JWT"}, claims: {"hello":"ok"}
```