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)) {
Bot.ArchiLogger.LogNullError(nameof(deviceID) + " || " + nameof(confirmationHash) + " || " + nameof(time) + " || " + nameof(confirmations));
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;
}