mirror of
https://github.com/LanceGin/jsotp.git
synced 2026-05-24 00:00:05 +08:00
add: basic function with comments
This commit is contained in:
+33
-6
@@ -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");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user