jwt-blacklist
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

JWT Black List

A black list for JWT base on bloom filter and xxhash

Install

npm install jwt-blacklist

TL;DR;

From version 0.1.0, jwt-blacklist is actually a black list instead of an extension of jsonwebtoken. It also supports Typescript and Redis now.

You can see older docs on Github

Usage

Create a blacklist

import { createBlackList } from 'jwt-blacklist';
 
// memory
const blacklist = await createBlackList({
  daySize: 10000, // optional, number of tokens need revoking each day
  errorRate: 0.001, // optional, error rate each day
});
 
// redis
const blacklist = await createBlackList({
  daySize: 10000, // optional, number of tokens need revoking each day
  errorRate: 0.001, // optional, error rate each day
  storeType: 'redis', // store type
  redisOptions: {
    host: 'localhost',
    port: 6379,
    key: 'jwt-blacklist', // optional: redis key prefix
  }, // optional, redis options
});

Add, has and clear

blacklist.add(token); // not allow jwt without exp
blacklist.has(token);
blacklist.clear();

Package Sidebar

Install

npm i jwt-blacklist

Weekly Downloads

45

Version

0.1.2

License

MIT

Unpacked Size

161 kB

Total Files

20

Last publish

Collaborators

  • nesso99