https://github.com/spyna/pretty-jwt
Pretty print JWTs in the command line
https://github.com/spyna/pretty-jwt
Last synced: about 1 year ago
JSON representation
Pretty print JWTs in the command line
- Host: GitHub
- URL: https://github.com/spyna/pretty-jwt
- Owner: Spyna
- License: mit
- Created: 2023-01-14T10:48:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T08:18:14.000Z (over 3 years ago)
- Last Synced: 2025-05-20T06:47:06.978Z (about 1 year ago)
- Language: TypeScript
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pretty JWT
> a cli to print pretty JWT
## Usage
```
# Install
npm install -g pretty-jwt
jwp
# or use directly
npx pretty-jwt
```
The install commands provides the command `jwp` *that is for `jw`(t) `p`(rint)*
## Examples
```
jwp eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6InNweW5hIiwiaWF0IjoxNzI2MjM5MDIyfQ.2k-IPAVDXSuEVKUKIh_qNB_6SwNnA4muLbTMy5lfNYI
```
will print
```
------- PRETTY JWT -------
{
"alg": "HS256",
"typ": "JWT"
}
.
{
"sub": "1234567890",
"name": "spyna",
"iat": 1726239022
}
```
## Errors
Errors are detected and printed
Example
```
jwp ""
```
will print
```
⚠️ invalid base64: ""
```
## Development
## run locally
Start `typescript` watching and build compiled js files into the `dist` folder with:
```
npm run dev
```
or
Compile typescript files using:
```
npm run build
```
Launch the compiled js with:
```
node dist/index.js eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6InNweW5hIiwiaWF0IjoxNzI2MjM5MDIyfQ.2k-IPAVDXSuEVKUKIh_qNB_6SwNnA4muLbTMy5lfNYI
```
### install locally
Install locally with:
```
npm run build
npm install -g .
```
Test the installation:
```
jwp eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6InNweW5hIiwiaWF0IjoxNzI2MjM5MDIyfQ.2k-IPAVDXSuEVKUKIh_qNB_6SwNnA4muLbTMy5lfNYI
```
### Release and publish
```
npm run build
npm run release
npm publish --dry-run
git push --follow-tags origin main
npm publish
```