From 0ae636aa53dc7e2f39a21e60612f6bd7771a34a0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 26 Nov 2018 08:26:36 -0500 Subject: [PATCH] use digits for steam --- src/services/totp.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/totp.service.ts b/src/services/totp.service.ts index ddda7df29b..aa4f8dd143 100644 --- a/src/services/totp.service.ts +++ b/src/services/totp.service.ts @@ -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); }