forked from github/jsotp
fix: type check error
This commit is contained in:
parent
c21f4ea701
commit
164718bcd4
@ -50,6 +50,10 @@ export class HOTP extends OTP {
|
||||
verify(otp, counter) {
|
||||
const otp_count = this.at(counter);
|
||||
|
||||
if (typeof(otp) === 'number') {
|
||||
otp = otp.toString();
|
||||
}
|
||||
|
||||
if (otp === otp_count) {
|
||||
return true;
|
||||
}
|
||||
|
@ -75,6 +75,10 @@ export class TOTP extends OTP {
|
||||
}
|
||||
otp_time = super.generate_otp(Util.timecode(time, this.interval));
|
||||
|
||||
if (typeof(otp) === 'number') {
|
||||
otp = otp.toString();
|
||||
}
|
||||
|
||||
if (otp === otp_time) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user