add: basic function with comments

This commit is contained in:
lancegin
2017-06-28 21:03:18 +08:00
parent c8853d9ae8
commit b144a14efe
4 changed files with 139 additions and 9 deletions
+43 -1
View File
@@ -6,5 +6,47 @@
import OTP from './otp';
class HOTP extends OTP {
/*
* Generate the OTP with the given count
*
* @param {count}
* @type {int}
* @desc the OTP HMAC counter
*
* @return {OTP}
*
* @example
* ```javascript
* let hotp = jsotp.HOTP.gen('BASE32_ENCODED_SECRET');
* hotp.at(0); // => 432143
* ```
*/
at(count) {
console.log("HOTP.at");
}
/*
* Verifies the OTP passed in against the current counter.
*
* @param {otp}
* @type {String}
* @desc the OTP waiting for checking
*
* @param {counter}
* @type {int}
* @desc the OTP HMAC counter
*
* @return {Boolean}
*
* @example
* ```javascript
* let hotp = jsotp.HOTP.gen('BASE32_ENCODED_SECRET');
* hotp.at(0); // => 432143
* hotp.verify(432143, 0); // => true
* hotp.verify(432143, 1); // => false
* ```
*/
verify(otp, counter) {
console.log("HOTP.verify");
}
}