internal async Task <bool?> HandleConfirmation(string deviceID, string confirmationHash, uint time, uint confirmationID, ulong confirmationKey, bool accept) { if (string.IsNullOrEmpty(deviceID) || string.IsNullOrEmpty(confirmationHash) || (time == 0) || (confirmationID == 0) || (confirmationKey == 0)) { Logging.LogNullError(nameof(deviceID) + " || " + nameof(confirmationHash) + " || " + nameof(time) + " || " + nameof(confirmationID) + " || " + nameof(confirmationKey), Bot.BotName); return(null); } if (!await RefreshSessionIfNeeded().ConfigureAwait(false)) { return(null); } string request = SteamCommunityURL + "/mobileconf/ajaxop?op=" + (accept ? "allow" : "cancel") + "&p=" + deviceID + "&a=" + SteamID + "&k=" + WebUtility.UrlEncode(confirmationHash) + "&t=" + time + "&m=android&tag=conf&cid=" + confirmationID + "&ck=" + confirmationKey; Steam.ConfirmationResponse response = await WebBrowser.UrlGetToJsonResultRetry <Steam.ConfirmationResponse>(request).ConfigureAwait(false); return(response?.Success); }
internal async Task <bool?> HandleConfirmations(string deviceID, string confirmationHash, uint time, HashSet <MobileAuthenticator.Confirmation> confirmations, bool accept) { if (string.IsNullOrEmpty(deviceID) || string.IsNullOrEmpty(confirmationHash) || (time == 0) || (confirmations == null) || (confirmations.Count == 0)) { Logging.LogNullError(nameof(deviceID) + " || " + nameof(confirmationHash) + " || " + nameof(time) + " || " + nameof(confirmations), Bot.BotName); return(null); } if (!await RefreshSessionIfNeeded().ConfigureAwait(false)) { return(null); } string request = SteamCommunityURL + "/mobileconf/multiajaxop"; List <KeyValuePair <string, string> > data = new List <KeyValuePair <string, string> >(7 + confirmations.Count * 2) { new KeyValuePair <string, string>("op", accept ? "allow" : "cancel"), new KeyValuePair <string, string>("p", deviceID), new KeyValuePair <string, string>("a", SteamID.ToString()), new KeyValuePair <string, string>("k", confirmationHash), new KeyValuePair <string, string>("t", time.ToString()), new KeyValuePair <string, string>("m", "android"), new KeyValuePair <string, string>("tag", "conf") }; foreach (MobileAuthenticator.Confirmation confirmation in confirmations) { data.Add(new KeyValuePair <string, string>("cid[]", confirmation.ID.ToString())); data.Add(new KeyValuePair <string, string>("ck[]", confirmation.Key.ToString())); } Steam.ConfirmationResponse response = await WebBrowser.UrlPostToJsonResultRetry <Steam.ConfirmationResponse>(request, data).ConfigureAwait(false); return(response?.Success); }