@asaje/token-generator
v0.0.2
Published
> Simple web token generator
Downloads
13
Readme
Token generator
Simple web token generator
Usage
Installation
npm install @asaje/token-generator
or
yarn add @asaje/token-generator
How it works
import { sign, verify } from '@asaje/token-generator';
const key = 'my-super-key';
const token = sign({ data: 'Hello world', key }); // Generate token
console.log('token', token);
try {
const info = verify({ key, token }); // Verify token
console.log('token-info', info);
} catch (error) {
console.log(error);
}