Ente Auth: Add support for Steam domain used as issuer

This commit is contained in:
Vladyslav Pashynskykh 2024-05-22 13:02:11 +03:00
parent 954581093d
commit d75abcf6a7
No known key found for this signature in database
GPG key ID: 6F8685377E0A9055
3 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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(