mirror of
https://github.com/LanceGin/jsotp.git
synced 2026-05-24 00:00:05 +08:00
fix: type check error
This commit is contained in:
@@ -50,6 +50,10 @@ export class HOTP extends OTP {
|
|||||||
verify(otp, counter) {
|
verify(otp, counter) {
|
||||||
const otp_count = this.at(counter);
|
const otp_count = this.at(counter);
|
||||||
|
|
||||||
|
if (typeof(otp) === 'number') {
|
||||||
|
otp = otp.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (otp === otp_count) {
|
if (otp === otp_count) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ export class TOTP extends OTP {
|
|||||||
}
|
}
|
||||||
otp_time = super.generate_otp(Util.timecode(time, this.interval));
|
otp_time = super.generate_otp(Util.timecode(time, this.interval));
|
||||||
|
|
||||||
|
if (typeof(otp) === 'number') {
|
||||||
|
otp = otp.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (otp === otp_time) {
|
if (otp === otp_time) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user