1.0.9 • Published 1 year ago

@xpresser/jwt v1.0.9

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

XpresserJs JWT Plugin

Easy and Fast jwt setup for your project.

This plugin makes use of fast-jwt with caching support out of the box.

MENU

Installation

npm i @xpresser/jwt
# OR
yarn add @xpresser/jwt

Add to plugins.json

{
  "npm://@xpresser/jwt": true
}

Add to your project config.

({
  // ... Other Configs
  "@xpresser/jwt": {
    secretKey: "My Secret Key!",
    signer: {
      expiresIn: 3_600_000 // in 1 hour
    },
    verifier: {cache: true}
  }
  
})

More signer and verifier configuration options can be found here

Usage

In your controller or anywhere in your project.

const {signJwt, verifyJwt} = require("@xpresser/jwt");

// Sign Data
const token = signJwt({user: 'john_doe'});

// Verify/Decode
verifyJwt(token) 
// { user: "john_doe", iat: 1634151036, exp: 1634151046}
1.0.9

1 year ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago