Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: use steam digits instead of hardcoding it everywhere

Prateek Sunale4ea377ee033
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,