jwt-validator
v0.1.1
Published
Generator and validator of a JWT token containing custom data
Downloads
171
Readme
JWT Generator/Validator
Generator and validator of a JWT token containing custom data
Usage
const { createToken, validateToken } = require('jwt-validator')
const SECRET = 'custom jwt secret'
const payload = { /* custom data */ }
/**
* To generate a token
*/
createToken(payload, SECRET, (err, token) => {
// token is a JWT signed token
})
/**
* To validate a token
*/
validateToken('token', SECRET, (err, data) => {
// data is the decoded token
})
Development
npm install
Test
Run all tests
npm test