https://github.com/hua1995116/jwt
a simple instance for jwt.
https://github.com/hua1995116/jwt
jwt node ts typescript
Last synced: about 1 month ago
JSON representation
a simple instance for jwt.
- Host: GitHub
- URL: https://github.com/hua1995116/jwt
- Owner: hua1995116
- License: mit
- Created: 2019-05-12T15:33:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:38:57.000Z (over 3 years ago)
- Last Synced: 2025-08-31T03:48:11.122Z (10 months ago)
- Topics: jwt, node, ts, typescript
- Language: TypeScript
- Homepage:
- Size: 137 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jwt
> a simple instance for jwt.
# Install
```shell
npm install jwt-plus
```
# Usage
```javascript
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 |
# reference
https://guseyn.com/posts/simple-jwt?v=1.0.85
https://azimi.me/2016/09/30/nyc-mocha-typescript.1.html
# License
MIT
Copyright (c) 2019 蓝色的秋风