New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

onceler

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onceler - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

lib/onceler/hotp.js

1

lib/onceler/index.js

@@ -26,1 +26,2 @@ /*

exports.TOTP = require('./totp');
exports.HOTP = require('./hotp');

2

lib/onceler/totp.js

@@ -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 @@ -------

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc