diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index 20faf37ae..630d03056 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -803,4 +803,8 @@ Process uptime: {1} You've declared --system-required, although your OS is missing required dependencies for that feature to work. Consider installing dbus, although you can also safely ignore this warning if you do not require inhibition to work properly. + + Decryption of {0} database component has failed. This can be OK if you've just changed your bot's {1}, you should no longer observe this warning on the next run then. Otherwise, you should investigate and find out the exact reason for failure. + {0} will be replaced by bot database component's name (string), {1} will be replaced by bot config component's name (string). + diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 749c7c023..f464d9004 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -2496,10 +2496,22 @@ public sealed class Bot : IAsyncDisposable, IDisposable { if (BotConfig.PasswordFormat.HasTransformation()) { if (!string.IsNullOrEmpty(accessTokenText)) { accessTokenText = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, accessTokenText).ConfigureAwait(false); + + if (string.IsNullOrEmpty(accessTokenText)) { + BotDatabase.AccessToken = null; + + ArchiLogger.LogGenericWarning(Strings.FormatWarningBotDatabaseComponentDecryptionFailed(nameof(BotDatabase.AccessToken), nameof(BotConfig.PasswordFormat))); + } } if (!string.IsNullOrEmpty(refreshTokenText)) { refreshTokenText = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, refreshTokenText).ConfigureAwait(false); + + if (string.IsNullOrEmpty(refreshTokenText)) { + BotDatabase.RefreshToken = null; + + ArchiLogger.LogGenericWarning(Strings.FormatWarningBotDatabaseComponentDecryptionFailed(nameof(BotDatabase.RefreshToken), nameof(BotConfig.PasswordFormat))); + } } }