From 7bd63e695134eefe072ae7558452123ccec3148d Mon Sep 17 00:00:00 2001 From: mdslab87 Date: Tue, 15 Aug 2017 12:44:24 +0200 Subject: [PATCH] added comments in session constructor --- README.md | 6 +++--- package.json | 3 ++- src/session.js | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3b83641..d6b5615 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ npm install secure-jws-session const Session = require('secure-jws-session') const config = { - secret: '@2e£$1#1&$23_-!', // a secret key - serverHost: 'www.mdslab.org', - time: 1 // in minutes + secret: '@2e£$1#1&$23_-!', // secret key (String) + serverHost: 'www.mdslab.org', // server hostname (String) + time: 1 // Set time expiration in minutes (Int) } const auth = new Session(config) diff --git a/package.json b/package.json index cd26ebe..2b54564 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "name": "secure-jws-session", - "version": "0.1.3", + "version": "0.1.4", "description": "Secure json web signature sessions with Redis", "main": "index.js", "scripts": { + "doc": "jsdoc2md --no-gfm src/session.js > api.md", "test": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" }, "keywords": [ diff --git a/src/session.js b/src/session.js index 8a0776e..621372d 100644 --- a/src/session.js +++ b/src/session.js @@ -7,7 +7,8 @@ class Session { /** * constructor config * @param {string} secret a secret key used to generate the token - * @param {string} serverHost the hostname of the server + * @param {string} serverHost hostname of the server + * @param {int} time minutes of life for the token */ constructor(config){ this.secret = config.secret @@ -30,7 +31,7 @@ class Session { /** * deleteToken description - * @param {type} token [user token] + * @param {type} token user token */ async deleteToken(token){ const decoded = await this.decodeToken(token)