Skip to content

Commit

Permalink
Fix reading encrypted secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Oct 19, 2023
1 parent 776c5fe commit 6a0d428
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2332,19 +2332,24 @@ private async Task InitModules() {
WalletBalance = 0;
WalletCurrency = ECurrencyCode.Invalid;

AccessToken = BotDatabase.AccessToken;
RefreshToken = BotDatabase.RefreshToken;
string? accessToken = BotDatabase.AccessToken;
string? refreshToken = BotDatabase.RefreshToken;

if (BotConfig.PasswordFormat.HasTransformation()) {
if (!string.IsNullOrEmpty(AccessToken)) {
AccessToken = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, AccessToken!).ConfigureAwait(false);
if (!string.IsNullOrEmpty(accessToken)) {
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
accessToken = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, accessToken!).ConfigureAwait(false);
}

if (!string.IsNullOrEmpty(RefreshToken)) {
AccessToken = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, RefreshToken!).ConfigureAwait(false);
if (!string.IsNullOrEmpty(refreshToken)) {
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
refreshToken = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, refreshToken!).ConfigureAwait(false);
}
}

AccessToken = accessToken;
RefreshToken = refreshToken;

CardsFarmer.SetInitialState(BotConfig.Paused);

if (SendItemsTimer != null) {
Expand Down

0 comments on commit 6a0d428

Please sign in to comment.