jwt/README.md

132 lines
2.9 KiB
Markdown
Raw Normal View History

2018-03-27 08:18:23 +00:00
# JWT
> This is a simple tool to sign, verify and show JSON Web Tokens ([JWT](http://jwt.io/)) from the command line, base [jwt-go](https://github.com/dgrijalva/jwt-go).
2018-03-27 09:35:31 +00:00
2018-04-03 02:40:49 +00:00
[![jwt](https://asciinema.org/a/P0O3XBCslMNam0UduazwPhB6o.png)](https://asciinema.org/a/P0O3XBCslMNam0UduazwPhB6o?autoplay=1)
2018-03-27 10:39:46 +00:00
2018-03-27 09:35:31 +00:00
# Install
2018-03-28 01:17:26 +00:00
build with go get
2018-03-27 10:25:33 +00:00
2018-03-27 09:35:31 +00:00
```
➜ go get -u github.com/ehlxr/jwt
```
2019-10-02 08:59:53 +00:00
build with make
2018-03-28 01:17:26 +00:00
```
➜ git clone https://github.com/ehlxr/jwt.git
2019-10-02 08:59:53 +00:00
➜ cd jwt && make install
2018-03-28 01:17:26 +00:00
```
2018-03-27 10:25:33 +00:00
or download [releases](https://github.com/ehlxr/jwt/releases) binary package.
2018-03-27 09:35:31 +00:00
# Usage
```
➜ jwt
JWT(Json Web Token) 工具
用于生成、验证、查看 JWT
Usage:
jwt [command]
Available Commands:
help Help about any command
2019-10-02 08:59:53 +00:00
show JWT Token 查看
2018-03-27 09:35:31 +00:00
sign JWT 签名
verify JWT token 验证
2019-10-02 08:59:53 +00:00
version Print version
2018-03-27 09:35:31 +00:00
Flags:
--config string config file (default is $HOME/.jwt.yaml)
-h, --help help for jwt
Use "jwt [command] --help" for more information about a command.
2018-03-27 10:22:46 +00:00
```
2019-10-02 08:59:53 +00:00
## JWT version
```
➜ jwt version
__ __ __ ______
/\ \ /\ \ _ \ \ /\__ _\
_\_\ \ \ \ \/ ".\ \ \/_/\ \/
/\_____\ \ \__/".~\_\ \ \_\
\/_____/ \/_/ \/_/ \/_/
Name: jwt
Version: v1.0.2
2019-11-20 09:36:23 +00:00
BuildTime: 2019-11-20 17:35:50
GitCommit: 2293dd91c1763169bb7a2d8d27120216a1f8c4b8
GoVersion: go version go1.13.4 darwin/amd64
2019-10-02 08:59:53 +00:00
```
2018-03-27 10:22:46 +00:00
## sign JWT
```
➜ jwt sign -h
签名 JWT token 并复制到剪切板
标记 * 号的 flag 为必须项
Usage:
jwt sign [flags]
Flags:
-c, --claims argList add additional claims. may be used more than once (default {})
-d, --data string * path or json to claims object to sign, '-' to read from clipboard, or '+' to use only -claim args
-H, --header argList add additional header params. may be used more than once (default {})
-h, --help help for sign
-k, --key string * path of keyfile or key argument
Global Flags:
--config string config file (default is $HOME/.jwt.yaml)
```
## show JWT
```
➜ jwt show -h
查看 JWT Token 内容
标记 * 号的 flag 为必须项
Usage:
jwt show [flags]
Flags:
-h, --help help for show
-t, --token string * path or arg of JWT token to verify, '-' to read from clipboard
Global Flags:
--config string config file (default is $HOME/.jwt.yaml)
```
## verify JWT
```
➜ jwt verify -h
验证 JWT token 是否有效
标记 * 号的 flag 为必须项
Usage:
jwt verify [flags]
Flags:
-h, --help help for verify
-k, --key string * path of keyfile or key argument
-t, --token string * path or arg of JWT token to verify, '-' to read from clipboard
Global Flags:
--config string config file (default is $HOME/.jwt.yaml)
2018-04-03 01:51:35 +00:00
```
2019-10-05 13:12:18 +00:00
## Thanks to the following organizations for providing open source licenses
2019-10-10 09:14:36 +00:00
[<img src="https://cdn.ehlxr.top/jetbrains.png" width = "200" height = "217" alt="图片名称" align=center />](https://www.jetbrains.com/?from=jwt)