nodejs-session-manager
v1.0.3
Published
A simple NPM package to generate and verify sessions for webservers
Downloads
8
Readme
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!" ]