Socket
Socket
Sign inDemoInstall

jwt-promisify

Package Overview
Dependencies
17
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jwt-promisify

A promisified version of jsonwebtoken with TypeScript support.


Version published
Weekly downloads
636
decreased by-11.67%
Maintainers
1
Install size
328 kB
Created
Weekly downloads
 

Changelog

Source

1.1.7 (January 11, 2023)

  • Added doc comments to type definitions
  • Updated dependencies to latest version
    • jsonwebtoken (8.5.1 -> 9.0.0)

Readme

Source

jwt-promisify


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.

Keywords

FAQs

Last updated on 11 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc