Fixing TOTP issue with the timestamp

This commit is contained in:
Anaïs Saraiva
2025-02-22 18:37:03 +01:00
parent 0f354a7d51
commit 9fbb8a8eb5

View File

@@ -30,7 +30,7 @@ class TOTP {
timestamp: Date.now(), timestamp: Date.now(),
...options, ...options,
}; };
const epochSeconds = Math.floor(_options.timestam / 1000); const epochSeconds = Math.floor(_options.timestamp / 1000);
const timeHex = this.dec2hex(Math.floor(epochSeconds / _options.period)).padStart(16, '0'); const timeHex = this.dec2hex(Math.floor(epochSeconds / _options.period)).padStart(16, '0');
const keyBuffer = _options.encoding === 'hex' ? this.base32ToBuffer(key) : this.asciiToBuffer(key); const keyBuffer = _options.encoding === 'hex' ? this.base32ToBuffer(key) : this.asciiToBuffer(key);