From bda4f2c8227e6670f02e295c9973cbdf274b7c77 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 11 Jan 2019 21:15:13 +0100 Subject: [PATCH] Make deviceIdentifier-less deviceIDs work with ASF 2FA --- ArchiSteamFarm/MobileAuthenticator.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index 188ddd564..350473798 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -287,16 +287,21 @@ namespace ArchiSteamFarm { return false; } - // To the best of my knowledge, Steam uses android identifier even on iOS and other devices right now - // If we ever need to correct this, we also need to clean up other places - const string deviceIdentifier = "android:"; + // This one is optional + int deviceIdentifierIndex = deviceID.IndexOf(':'); - if (!deviceID.StartsWith(deviceIdentifier, StringComparison.Ordinal) || (deviceID.Length <= deviceIdentifier.Length)) { - return false; + if (deviceIdentifierIndex >= 0) { + deviceIdentifierIndex++; + + if (deviceID.Length <= deviceIdentifierIndex) { + return false; + } + + deviceID = deviceID.Substring(deviceIdentifierIndex); } // Dashes are optional in the ID, strip them off for comparison - string hash = deviceID.Substring(deviceIdentifier.Length).Replace("-", ""); + string hash = deviceID.Replace("-", ""); return (hash.Length > 0) && Utilities.IsValidHexadecimalString(hash); }