Serialize sensitive details in /Api/Structure

This commit is contained in:
JustArchi
2017-12-10 01:08:01 +01:00
parent 1574af29dd
commit 4af094ed47

View File

@@ -138,9 +138,11 @@ namespace ArchiSteamFarm {
[JsonProperty]
internal string SteamPassword { get; set; }
public bool ShouldSerializeSteamLogin() => false;
public bool ShouldSerializeSteamParentalPIN() => false;
public bool ShouldSerializeSteamPassword() => false;
private bool ShouldSerializeSensitiveDetails = true;
public bool ShouldSerializeSteamLogin() => ShouldSerializeSensitiveDetails;
public bool ShouldSerializeSteamParentalPIN() => ShouldSerializeSensitiveDetails;
public bool ShouldSerializeSteamPassword() => ShouldSerializeSensitiveDetails;
internal static BotConfig Load(string filePath) {
if (string.IsNullOrEmpty(filePath)) {
@@ -166,6 +168,8 @@ namespace ArchiSteamFarm {
return null;
}
botConfig.ShouldSerializeSensitiveDetails = false;
// Support encrypted passwords
if ((botConfig.PasswordFormat != CryptoHelper.ECryptoMethod.PlainText) && !string.IsNullOrEmpty(botConfig.SteamPassword)) {
// In worst case password will result in null, which will have to be corrected by user during runtime