npm.io
1.0.0 • Published 4 years ago

jwt-token-utility

Licence
MIT
Version
1.0.0
Deps
1
Size
3 kB
Vulns
3
Weekly
0

JWT Token Utility

It is a utility that seeks to save a few lines of code when generating a token and decoding it using jsonwebtoken.

Install

$ npm install jwt-token-utility

Usage

For create a token

import { createToken } from "jwt-token-utility";

const token = createToken({ id: 2, name: "user" }, "SECRET_KEY", "2d");

For verify token

import { verifyToken } from "jwt-token-utility";

try {
  verifyToken("TOKEN", "SECRET_KEY");
} catch (err) {
  console.log(err.message);
}

Author

Davic64

Licence

This project is licensed under the MIT license. See the LICENSE file for more info.

Keywords