default opt to {} where appropriate
This commit is contained in:
parent
66f1f0fe3f
commit
a653c7e624
6
index.js
6
index.js
@ -19,7 +19,8 @@ var hotp = {};
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
hotp.gen = function(key, opt) {
|
hotp.gen = function(key, opt) {
|
||||||
var key = key || '';
|
key = key || '';
|
||||||
|
opt = opt || {};
|
||||||
var counter = opt.counter || 0;
|
var counter = opt.counter || 0;
|
||||||
|
|
||||||
var p = 6;
|
var p = 6;
|
||||||
@ -77,6 +78,7 @@ hotp.gen = function(key, opt) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
hotp.verify = function(token, key, opt) {
|
hotp.verify = function(token, key, opt) {
|
||||||
|
opt = opt || {};
|
||||||
var window = opt.window || 50;
|
var window = opt.window || 50;
|
||||||
var counter = opt.counter || 0;
|
var counter = opt.counter || 0;
|
||||||
|
|
||||||
@ -115,6 +117,7 @@ var totp = {};
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
totp.gen = function(key, opt) {
|
totp.gen = function(key, opt) {
|
||||||
|
opt = opt || {};
|
||||||
var time = opt.time || 30;
|
var time = opt.time || 30;
|
||||||
var _t = new Date().getTime();;
|
var _t = new Date().getTime();;
|
||||||
|
|
||||||
@ -165,6 +168,7 @@ totp.gen = function(key, opt) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
totp.verify = function(token, key, opt) {
|
totp.verify = function(token, key, opt) {
|
||||||
|
opt = opt || {};
|
||||||
var time = opt.time || 30;
|
var time = opt.time || 30;
|
||||||
var _t = new Date().getTime();
|
var _t = new Date().getTime();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user