https://github.com/clarketm/jwt-cli
Command line tool for working with JSON Web Tokens (JWT)
https://github.com/clarketm/jwt-cli
cli command-line jsonwebtoken jwt node
Last synced: 10 months ago
JSON representation
Command line tool for working with JSON Web Tokens (JWT)
- Host: GitHub
- URL: https://github.com/clarketm/jwt-cli
- Owner: clarketm
- License: mit
- Created: 2018-05-25T16:55:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T10:47:14.000Z (about 3 years ago)
- Last Synced: 2024-10-30T04:49:22.395Z (over 1 year ago)
- Topics: cli, command-line, jsonwebtoken, jwt, node
- Language: JavaScript
- Homepage: https://blog.travismclarke.com/project/jwt-cli/
- Size: 37 MB
- Stars: 40
- Watchers: 5
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [jwt-cli](https://blog.travismclarke.com/project/jwt-cli/)
[](https://www.npmjs.com/package/@clarketm/jwt-cli)
[](LICENSE.md)
Command line tool for working with JSON Web Tokens (JWT).
## Installation
### Yarn
```shell
yarn global add "@clarketm/jwt-cli"
```
### Npm
```shell
npm install --global "@clarketm/jwt-cli"
```
## Demo

## Usage
---
### `sign [options] payload secret`
```shell
$ jwt sign '{"user": "Travis Clarke"}' "super secret"
```
```shell
copied to clipboard:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxLCJpYXQiOjE1MjczMTI3NTIsImV4cCI6MTUyNzMxNjM1Mn0.2l4wyaoxNBBY7nvm6sAqAcmXSuuKjBubNo_h42hcigU
```
> Note: the `sign` subcommand accepts **all** the same [**options**](https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback) as [`auth0/node-jsonwebtoken`](https://github.com/auth0/node-jsonwebtoken) with the exception of `mutatePayload` which is not applicable.
| Option | Description |
| ------------------ | --------------------------------------------------- |
| `-n, --noCopy` | Do not copy the token to the clipboard. |
| `-p, --passphrase` | The passphrase for your secret (if it is encrypted) |
---
### `verify [options] token secret`
```shell
$ jwt verify "eyJhbGciOiJIUzI1..." "super secret"
```
```
valid!
```
> Note: the `verify` subcommand accepts **all** the same [**options**](https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback) as [`auth0/node-jsonwebtoken`](https://github.com/auth0/node-jsonwebtoken)
---
### `decode [options] token`
```shell
$ jwt decode "eyJhbGciOiJIUzI1..."
```
```shell
copied to clipboard:
{
user: 'Travis Clarke',
iat: 1537507542,
exp: 1537511142
}
```
> Note: the `decode` subcommand accepts **all** the same [**options**](https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback) as [`auth0/node-jsonwebtoken`](https://github.com/auth0/node-jsonwebtoken) with the exception of `json` which is not applicable.
| Option | Description |
| -------------- | ----------------------------------------- |
| `-n, --noCopy` | Do not copy the payload to the clipboard. |
---
## Related
- [node-jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) – JsonWebToken implementation for node.js
## License
MIT © [**Travis Clarke**](https://blog.travismclarke.com/)
