Encode & Decode JWT Tokens
go install github.com/mehditeymorian/jwt/v2@latest
Commands are as below:
- config: view, edit, and set config
- encode: create standard JWT token
- decode: decode a JWT token
- gen: generate different keys such as rsa, hmac, ecdsa
# run the following command to see the full details.
jwt help
The JWT
use corresponding set of keys when you use different commands. For example, it will use rsa keys if you use command jwt gen rsa
.
interactive: true
rsa:
public_key: |-
key
private_key: |-
key
hmac:
key: key
base64_encoded: false
ecdsa:
public_key: |-
key
private_key: |-
key
Note: if
interactive
config set to true, the command parameters will be taken from user interactively instead of reading them from command options.
use
-c
option to pass config file address.
The order of reading config is as follows if config is not specified as option:
.jwt.(yaml|yml)
file in the path where theJWT
is running./etc/jwt/.jwt.(yaml|yml)
file as default configuration. if config file is not present, one will be created.
Any contribution in any form is welcomed. Open an issue to discuss it.
Unless otherwise noted, the JWT source files are distributed under the Apache Version 2.0 license found in the LICENSE file.