0.3.5 • Published 6 years ago
musession v0.3.5
μSession (MuSession)
Node.js module to manage secure sessions with a JSON file
Installation
$ git clone https://github.com/kimihub/musession.js.git
$ npm install ./musession
or
$ npm install musession
Usage
Initialization
var musession = require('musession');
Parameters
All methods return the musession instance
musession.setJSONfile('/path/to/json/file'); // default null, sessions will only be cached
musession.setLifetime(604800000); // default to 1 week in microseconds, Cron Clean Sessions will run once a week
Check if a session exists
musession.exists(PrivateKeyHash, function next(res, PrivateKeyHash, ExpirationDate){
if (res)
console.log('This session exists');
else
console.log('This session does not exist');
});
Create a session
musession.secure(function next(PrivateKeyHash, ExpirationDate) {
console.log(PrivateKeyHash + ' is the unique session ID and expires in ' + ExpirationDate + ' microseconds');
});
Destroy a session
Return the musession instance
musession.kill(PrivateKeyHash);
Author
Kim I. Castelli (Kimi) <kim.himitsu{at}gmail.com>