npm.io
1.0.1 • Published 4 years ago

tokenmgr

Licence
GPL-3.0
Version
1.0.1
Deps
0
Size
4 kB
Vulns
0
Weekly
0

Get started!

The first step is to import the module in your node.

const tokenmgr = require("tokenmgr");

Then, initialize a new instance of the manager.

const tm = new tokenmgr();

How to create tokens?

You have to a single line to create a token.

tm.create(64, {});

To add creation options, specify them into the braces.

tm.create(64, {
  avoidNumbers: true,
  allUpperCase: true,
  allLowerCase: true,
});

To disable an option, you just have to remove it from the table.

All options are disabled by default.

How to store them ?

Just use the tm.store() function.

tm.store("name", token);

// You can create a token directly into the 'tm.store()' function.
tm.store("name", token);

Delete tokens with the tm.del() function.

tm.del("name");

And get them with the tm.get() function.

tm.get("name");

Keywords