a simple instance for jwt.
npm install jwt-plus
import {encode, decode} from 'jwt-plus'
const payload = {k: 1};
const token = encode(payload, secret);
const [isPass, parseValue] = decode(token, secret);
// [true, {k: 1, exp: XXX}]
- encode(payload, secret, [options]) ⇒
string
jwt encode payload
- decode(token, secret) ⇒
Array
jwt decode token
jwt encode payload
Kind: global function
Export:
Param | Type |
---|---|
payload | * |
secret | string |
[options] | Object |
jwt decode token
Kind: global function
Returns: Array
- [Boolean, any]
Export:
Param | Type |
---|---|
token | string |
secret | string |
https://guseyn.com/posts/simple-jwt?v=1.0.85 https://azimi.me/2016/09/30/nyc-mocha-typescript.1.html
MIT
Copyright (c) 2019 蓝色的秋风