Add support for encrypted passwords, closes #267

This commit is contained in:
JustArchi
2016-06-28 04:32:48 +02:00
parent a01e718e28
commit 8d9fbce2ed
8 changed files with 222 additions and 4 deletions

View File

@@ -45,6 +45,10 @@ namespace ArchiSteamFarm {
[JsonProperty]
internal string SteamPassword { get; set; }
[JsonProperty(Required = Required.DisallowNull)]
[SuppressMessage("ReSharper", "ConvertToConstant.Local")]
private readonly CryptoHelper.ECryptoMethod PasswordFormat = CryptoHelper.ECryptoMethod.PlainText;
[JsonProperty]
internal string SteamParentalPIN { get; set; } = "0";
@@ -125,6 +129,12 @@ namespace ArchiSteamFarm {
return null;
}
// Support encrypted passwords
if (!string.IsNullOrEmpty(botConfig.SteamPassword) && (botConfig.PasswordFormat != CryptoHelper.ECryptoMethod.PlainText)) {
// In worst case password will result in null, which will have to be corrected by user during runtime
botConfig.SteamPassword = CryptoHelper.Decrypt(botConfig.PasswordFormat, botConfig.SteamPassword);
}
// User might not know what he's doing
// Ensure that he can't screw core ASF variables
if (botConfig.GamesPlayedWhileIdle.Count <= CardsFarmer.MaxGamesPlayedConcurrently) {