Comparing version 0.0.2 to 0.0.3
@@ -26,1 +26,2 @@ /* | ||
exports.TOTP = require('./totp'); | ||
exports.HOTP = require('./hotp'); |
@@ -53,2 +53,2 @@ /* | ||
TOTP.prototype.timeCode = timeCode; | ||
OTP.prototype.verify = verify; | ||
TOTP.prototype.verify = verify; |
{ | ||
"name": "onceler", | ||
"description": "OTP (One Time Password) facilities for node.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"engines": { | ||
@@ -13,3 +13,3 @@ "node": ">=0.2.6" | ||
"author": "Chris Umbel <chris@chrisumbel.com>", | ||
"keywords": ["otp", "totp", "one-time", "password"], | ||
"keywords": ["otp", "hotp", "totp", "one-time", "password"], | ||
"main": "./lib/onceler/index.js", | ||
@@ -16,0 +16,0 @@ "maintainers": [{ |
@@ -14,9 +14,9 @@ | ||
// get the value at a specified time index | ||
// get the password at a specified time index | ||
console.log(totp.at(650269)); | ||
// get the value for the current time | ||
// get the password for the current time | ||
console.log(totp.now()); | ||
// verify a user supplied value | ||
// verify a user supplied password | ||
if(totp.verify(1234567)) { | ||
@@ -27,3 +27,38 @@ console.log('access granted!'); | ||
} | ||
OTP digit size and time interval can be specified as such: | ||
// 60 second interval | ||
var totp = new TOTP('IFAUCQKCIJBEE===', null, 60); | ||
// 12 digit size | ||
var totp = new TOTP('IFAUCQKCIJBEE===', 12); | ||
// both | ||
var totp = new TOTP('IFAUCQKCIJBEE===', 12, 60); | ||
HOTP | ||
---- | ||
HOTP is also supported. | ||
var HOTP = require('onceler').HOTP; | ||
// create an HOTP object for a given base-32 encoded secret. | ||
var hotp = new HOTP('IFAUCQKCIJBEE==='); | ||
// hotp.verify(password, count) | ||
if(hotp.verify(581561, 0)) { | ||
console.log('access granted!'); | ||
} else { | ||
console.log('access denied!'); | ||
} | ||
if(hotp.verify(224556, 1)) { | ||
console.log('access granted!'); | ||
} else { | ||
console.log('access denied!'); | ||
} | ||
LICENSE | ||
@@ -30,0 +65,0 @@ ------- |
21954
13
255
83