public async void RequestSMSCode() { // adding a phone to Steam should not be handled by Bitwarden bool hasPhone = await HasPhoneAttached(); if (!hasPhone) { throw new Exception("USER HAS TO APPEND A PHONE NUMBER"); } var postData = new NameValueCollection(); postData.Add("access_token", _steamSession.OAuthToken); postData.Add("steamid", _steamSession.SteamID.ToString()); postData.Add("authenticator_type", "1"); postData.Add("device_identifier", _steamGuardData.DeviceID); postData.Add("sms_phone_id", "1"); string response = await SteamWebHelper.MobileLoginRequest(SteamAPIEndpoints.STEAMAPI_BASE + "/ITwoFactorService/AddAuthenticator/v0001", "POST", postData); if (response == null) { throw new Exception("GENERAL EXCEPTION"); } var addAuthenticatorResponse = JsonConvert.DeserializeObject <AddAuthenticatorResponse>(response); if (addAuthenticatorResponse == null || addAuthenticatorResponse.Response == null) { throw new Exception("GENERAL EXCEPTION"); } if (addAuthenticatorResponse.Response.Status == 29) { throw new Exception("ALLREADY LINKED TO STEAM AUTHENTICATOR"); } if (addAuthenticatorResponse.Response.Status != 1) { throw new Exception("GENERAL EXCEPTION"); } _steamGuardData = addAuthenticatorResponse.Response; }
private static void decryptFiles(string folderWithKeys, string folderForResult, string password, List <ManifestEntryData> entries) { string fileKey; string fileDec; Console.WriteLine("Decrypt..."); foreach (var item in entries) { fileKey = folderWithKeys + "/" + item.Filename; if (File.Exists(fileKey)) { string decData = decryptData(password, item.Salt, item.IV, File.ReadAllText(fileKey)); SteamGuardData account = JsonConvert.DeserializeObject <SteamGuardData>(decData); fileDec = folderForResult + "/" + account.AccountName + ".maFile"; if (!File.Exists(fileDec)) { File.Create(fileDec).Close(); } File.WriteAllText(fileDec, JsonConvert.SerializeObject(account)); } } }