⚠️ This package is no longer necessary because all function calls are now completed synchronously. Please usejsonwebtokendirectly.
jwt-promisify is a wrapper for jsonwebtoken with support for Promises and TypeScript.
Install this package using NPM:
npm install jwt-promisify --saveimport jwt from "jwt-promisify";Or using CommonJS:
const jwt = require("jwt-promisify");Decodes a token without verifying the signature. Returns null if the token cannot be decoded.
| Parameter | Type | Optional | Description |
|---|---|---|---|
token |
string |
❌ | A signed token. |
options |
DecodeOptions |
✔ | Options for decoding. |
Warning This method does not verify the signature. You should not use this method to decode untrusted tokens. You most likely want to use
jwt.verify()instead.
Signs a payload and generates a token.
| Parameter | Type | Optional | Description |
|---|---|---|---|
payload |
string, object, Buffer |
❌ | Token payload. |
key |
Key |
❌ | Secret key. |
options |
SignOptions |
✔ | Options for signing. |
Verifies and decodes a given token.
| Parameter | Type | Optional | Description |
|---|---|---|---|
token |
string |
❌ | A signed token. |
key |
Key |
❌ | Secret key. |
options |
VerifyOptions |
✔ | Options for signing. |
A secret key used for signing and verifying tokens. Can be one of the following:
stringBuffer{ key: string; passphrase: string; }
- TypeScript definitions adapted from
@types/jsonwebtoken
This project is licensed under MIT.

