Skip to content

VasilevVitalii/vv-jwt

Repository files navigation

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)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published