Skip to content

armgit / ente

Public Imported from GitHub
0

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

Ente Auth: Add support for Steam domain used as issuer

Vladyslav Pashynskykhd75abcf6a737
diff --git a/auth/lib/models/code.dart b/auth/lib/models/code.dart
index 7a7daf58dd..112d508da3 100644
--- a/auth/lib/models/code.dart
+++ b/auth/lib/models/code.dart
@@ -205,7 +205,7 @@ class Code {
try {
return int.parse(uri.queryParameters['digits']!);
} catch (e) {
- if (issuer.toLowerCase() == "steam") {
+ if (issuer.toLowerCase() == "steam" || issuer.toLowerCase().contains('steampowered.com')) {
return steamDigits;
}
return defaultDigits;
diff --git a/auth/lib/onboarding/view/setup_enter_secret_key_page.dart b/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
index 6741788c30..b4ab8bfd0f 100644
--- a/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
+++ b/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
@@ -240,7 +240,7 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
final account = _accountController.text.trim();
final issuer = _issuerController.text.trim();
final secret = _secretController.text.trim().replaceAll(' ', '');
- final isStreamCode = issuer.toLowerCase() == "steam";
+ final isStreamCode = issuer.toLowerCase() == "steam" || issuer.toLowerCase().contains('steampowered.com');
if (widget.code != null && widget.code!.secret != secret) {
ButtonResult? result = await showChoiceActionSheet(
context,
diff --git a/auth/lib/utils/totp_util.dart b/auth/lib/utils/totp_util.dart
index 1b0c874bd9..61c7f20e92 100644
--- a/auth/lib/utils/totp_util.dart
+++ b/auth/lib/utils/totp_util.dart
@@ -4,7 +4,7 @@ import 'package:otp/otp.dart' as otp;
import 'package:steam_totp/steam_totp.dart';
String getOTP(Code code) {
- if (['steam', 'steampowered.com'].contains(code.issuer.toLowerCase())) {
+ if (code.type == Type.steam) {
return _getSteamCode(code);
}
if (code.type == Type.hotp) {
@@ -39,7 +39,7 @@ String _getSteamCode(Code code, [bool isNext = false]) {
}
String getNextTotp(Code code) {
- if (['steam', 'steampowered.com'].contains(code.issuer.toLowerCase())) {
+ if (code.type == Type.steam) {
return _getSteamCode(code, true);
}
return otp.OTP.generateTOTPCodeString(