0.1.2 • Published 4 years ago

jwt-blacklist v0.1.2

Weekly downloads
150
License
MIT
Repository
gitlab
Last release
4 years ago

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();
0.1.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.2

7 years ago

0.0.1

7 years ago