From e4ea377ee03341429bd5316430d638e41c299961 Mon Sep 17 00:00:00 2001 From: Prateek Sunal Date: Sat, 27 Apr 2024 15:44:58 +0530 Subject: [PATCH] fix: use steam digits instead of hardcoding it everywhere --- auth/lib/utils/totp_util.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/auth/lib/utils/totp_util.dart b/auth/lib/utils/totp_util.dart index c01f4843ec..3de7f50477 100644 --- a/auth/lib/utils/totp_util.dart +++ b/auth/lib/utils/totp_util.dart @@ -9,7 +9,8 @@ String getOTP(Code code) { return otp.OTP.generateTOTPCodeString( getSanitizedSecret(code.secret), DateTime.now().millisecondsSinceEpoch, - length: code.issuer.toLowerCase() == "steam" ? 5 : code.digits, + length: + code.issuer.toLowerCase() == "steam" ? Code.steamDigits : code.digits, interval: code.period, algorithm: _getAlgorithm(code), isGoogle: true, @@ -20,7 +21,8 @@ String _getHOTPCode(Code code) { return otp.OTP.generateHOTPCodeString( getSanitizedSecret(code.secret), code.counter, - length: code.issuer.toLowerCase() == "steam" ? 5 : code.digits, + length: + code.issuer.toLowerCase() == "steam" ? Code.steamDigits : code.digits, algorithm: _getAlgorithm(code), isGoogle: true, ); @@ -30,7 +32,8 @@ String getNextTotp(Code code) { return otp.OTP.generateTOTPCodeString( getSanitizedSecret(code.secret), DateTime.now().millisecondsSinceEpoch + code.period * 1000, - length: code.issuer.toLowerCase() == "steam" ? 5 : code.digits, + length: + code.issuer.toLowerCase() == "steam" ? Code.steamDigits : code.digits, interval: code.period, algorithm: _getAlgorithm(code), isGoogle: true,