1.0.3 • Published 5 years ago

nodejs-session-manager v1.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

nodejs-session-manager

A simple NPM package to generate and verify sessions

const session = require("nodejs-session-manager");
{"tokenLength":16,"expires":86400000,"database":{"type":"File System","fileSystem":{"path":"./sessions/"}}}

And you have to call the initialize function.

session.init();
session.createSession("J0eppp", "1.1.1.1");

If everything is set up correctly, you should get "J0eppp.json" with the following data:

{"username":"J0eppp","sessionToken":"dgAHQh5G006dXg13","ip":"1.1.1.1"}

(The sessionToken looks different ofcourse)

session.verifySession(username, cookies, ip);

This'll return:

[ true ]

or:

[ false, "No session" ]

or:

[ false, "sessionToken or ip isn't the same!" ]

or:

[ false, "No session token is found!" ]