vv-jwt
v0.0.6
Published
simple creator and checker jwt
Downloads
4
Readme
vv-jwt, simple creator and checker jwt
License
MIT
Install
npm i vv-jwt
Example
import { Create as CreateJwtManager } from 'vv-jwt'
const jwtManager = CreateJwtManager({
secret: 'my secret',
issDefault: 'my application',
expDelta: 1000 * 60 * 60 *24, //create tokens with one day life
})
// create token
const j = jwtManager.create()
if (j.error) {
console.error(j.error)
} else {
console.log(`token - ${j.jwtString}`)
}
// check token
const c = jwtManager.check(j.jwtString)
if (c.deny) {
console.log(`NO SUCCESS CHECK TOKEN: ${c.deny.code} - ${c.deny.message}`)
} else {
console.log(c.jwt)
}