@darkwolf/jwt
v100.0.5
Published
JSON Web Token
Downloads
8
Maintainers
Readme
JSON Web Token
Install
npm i --save @darkwolf/jwt
Usage
// ECMAScript
import JWT from '@darkwolf/jwt'
// CommonJS
const JWT = require('@darkwolf/jwt')
const jwt = new JWT({
uid: 'PavelWolfDark',
admin: true
}, {
issuer: 'auth.darkwolf',
subject: 'auth.darkwolf',
expiresIn: 3600
})
const secretKey = 'Ave, Darkwolf!'
const signedToken = jwt.sign(secretKey)
const decodedToken = new JWT(signedToken)
const payload = decodedToken.verify(secretKey)