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
+33 -6
View File
@@ -4,17 +4,44 @@
*/
export default class OTP {
/*
* This constructor will create OTP instance.
*
* @param {secret}
* @type {String}
* @desc random base32-encoded key, it is the
* key that be used to verify.
*
* @param {digits}
* @type {int}
* @desc the length of the one-time password, default to be 6
*
* @param {digest}
* @type {String}
* @desc the key that be used to do HMAC encoding, dedault and
* only to be "sha1"
*
*/
constructor(secret, digits=6, digest="sha1") {
/*
* This constructor will create OTP instance
*/
this.secret = secret;
this.digits = digits;
this.digest = digest;
};
}
generate_otp() {
/*
* When class HOTP or TOTP pass the input params to this
* function, it will generate the OTP object with params,
* the params may be counter or time.
*
* @param {input}
* @type {int}
* @desc input params to generate OTP object, maybe
* counter or time.
*
* @return {OTP}
*/
generate_otp(input) {
console.log("OTP.generate_otp");
};
}
}