1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-08-25 23:03:07 +02:00

use digits for steam

This commit is contained in:
Kyle Spearrin 2018-11-26 08:26:36 -05:00
parent 5b59f888e0
commit 0ae636aa53

View File

@ -53,6 +53,7 @@ export class TotpService implements TotpServiceAbstraction {
}
} else if (isSteamAuth) {
keyB32 = key.substr('steam://'.length);
digits = 5;
}
const epoch = Math.round(new Date().getTime() / 1000.0);
@ -79,7 +80,7 @@ export class TotpService implements TotpServiceAbstraction {
if (isSteamAuth) {
// tslint:disable-next-line
let fullCode = binary & 0x7fffffff;
for (let i = 0; i < 5; i++) {
for (let i = 0; i < digits; i++) {
otp += SteamChars[fullCode % SteamChars.length];
fullCode = Math.trunc(fullCode / SteamChars.length);
}