jwt-plus
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

jwt

a simple instance for jwt.

Install

npm install jwt-plus

Usage

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

Interface

Functions

encode(payload, secret, [options])string

jwt encode payload

decode(token, secret)Array

jwt decode token

encode(payload, secret, [options]) ⇒ string

jwt encode payload

Kind: global function
Export:

Param Type
payload *
secret string
[options] Object

decode(token, secret) ⇒ Array

jwt decode token

Kind: global function
Returns: Array - [Boolean, any]
Export:

Param Type
token string
secret string

License

MIT

Copyright (c) 2019 蓝色的秋风

Readme

Keywords

Package Sidebar

Install

npm i jwt-plus

Weekly Downloads

0

Version

0.1.3

License

MIT

Unpacked Size

8.48 kB

Total Files

14

Last publish

Collaborators

  • hua1995116