Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-jwt

Package Overview
Dependencies
Maintainers
11
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-jwt

Fast JSON Web Token implementation

  • 3.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
237K
decreased by-0.33%
Maintainers
11
Weekly downloads
 
Created

What is fast-jwt?

The fast-jwt package is a high-performance JSON Web Token (JWT) library for Node.js. It is designed to be fast and efficient, providing a simple API for creating, verifying, and decoding JWTs.

What are fast-jwt's main functionalities?

Creating a JWT

This feature allows you to create a JWT using a secret key. The `createSigner` function generates a signer function that can be used to sign payloads and create tokens.

const { createSigner } = require('fast-jwt');
const signer = createSigner({ key: 'your-secret-key' });
const token = signer({ userId: 123 });
console.log(token);

Verifying a JWT

This feature allows you to verify a JWT using a secret key. The `createVerifier` function generates a verifier function that can be used to verify tokens and extract the payload.

const { createVerifier } = require('fast-jwt');
const verifier = createVerifier({ key: 'your-secret-key' });
try {
  const payload = verifier(token);
  console.log(payload);
} catch (err) {
  console.error('Invalid token', err);
}

Decoding a JWT

This feature allows you to decode a JWT without verifying its signature. The `decode` function extracts the payload from the token.

const { decode } = require('fast-jwt');
const payload = decode(token);
console.log(payload);

Other packages similar to fast-jwt

Keywords

FAQs

Package last updated on 05 Oct 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc