1.1.7 • Published 1 year ago

jwt-promisify v1.1.7

Weekly downloads
67
License
MIT
Repository
github
Last release
1 year ago

Travis CI NPM downloads Size License

NPM install info

Table of contents

About

jwt-promisify is a wrapper for jsonwebtoken with support for Promises and TypeScript.

Installation

Install this package using NPM:

npm install jwt-promisify --save

Usage

import jwt from "jwt-promisify";

Or using CommonJS:

const jwt = require("jwt-promisify");

API Documentation

jwt.decode(token)

Decodes a token without verifying the signature. Returns null if the token cannot be decoded.

ParameterTypeOptionalDescription
tokenstringA signed token.
optionsDecodeOptionsOptions 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.

jwt.sign(payload, key, options)

Signs a payload and generates a token.

ParameterTypeOptionalDescription
payloadstring, object, BufferToken payload.
keyKeySecret key.
optionsSignOptionsOptions for signing.

jwt.verify(token, key, options)

Verifies and decodes a given token.

ParameterTypeOptionalDescription
tokenstringA signed token.
keyKeySecret key.
optionsVerifyOptionsOptions for signing.

Key

A secret key used for signing and verifying tokens. Can be one of the following:

  • string
  • Buffer
  • { key: string; passphrase: string; }

Resources

Acknowledgements

License

This project is licensed under MIT.

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago