fix: provided hashType into getOTP
This commit is contained in:
parent
f32349717f
commit
ce93c2fb70
@ -58,6 +58,6 @@ export function getTOTP(
|
||||
timeOffset = 0,
|
||||
hashType = "SHA-1",
|
||||
) {
|
||||
const unixTime = Math.round((time / 1000 + timeOffset) / fetchTime);
|
||||
return getHOTP(BigInt(unixTime), secret, digits);
|
||||
const unixTime = Math.round((time / 1000n + timeOffset) / fetchTime);
|
||||
return getHOTP(BigInt(unixTime), secret, digits, hashType);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export class TOTP {
|
||||
*/
|
||||
getOTP(time = Date.now()) {
|
||||
const unixTime = (time / 1000 + this.timeOffset) / this.fetchTime;
|
||||
const otp = getHOTP(Math.floor(unixTime), this.secret, this.digits);
|
||||
const otp = getHOTP(Math.floor(unixTime), this.secret, this.digits, this.hashType);
|
||||
const expireTime =
|
||||
time +
|
||||
(this.fetchTime -
|
||||
|
Loading…
x
Reference in New Issue
Block a user