Adds DepotDownloaderAuthenticator.cs to handle hooks on SteamKit2 new Auth

pull/503/head
Iluha 3 years ago
parent c929eb3a1c
commit 5a219337f5

@ -0,0 +1,60 @@
using System;
using System.Threading.Tasks;
using SteamKit2.Authentication;
namespace DepotDownloader;
public class DepotDownloaderAuthenticator : IAuthenticator
{
public Task<string> GetDeviceCodeAsync(bool previousCodeWasIncorrect)
{
if (previousCodeWasIncorrect)
{
Console.Out.WriteLine("[2FA]|[Wrong]|The previous 2-factor auth code you have provided is incorrect.");
}
string? code;
do
{
Console.Out.Write("[2FA]|Please enter your 2 factor auth code from your authenticator app: ");
code = Console.ReadLine()?.Trim();
if (code == null)
{
break;
}
} while (string.IsNullOrEmpty(code));
return Task.FromResult(code!);
}
public Task<string> GetEmailCodeAsync(string email, bool previousCodeWasIncorrect)
{
if (previousCodeWasIncorrect)
{
Console.Out.WriteLine("[Guard]|[Wrong]|The previous 2-factor auth code you have provided is incorrect.");
}
string? code;
do
{
Console.Out.Write($"[Guard]|Please enter the authentication code sent to your email address: ");
code = Console.ReadLine()?.Trim();
if (code == null)
{
break;
}
} while (string.IsNullOrEmpty(code));
return Task.FromResult(code!);
}
public Task<bool> AcceptDeviceConfirmationAsync()
{
Console.Out.WriteLine("[MobileApp]|Use the Steam Mobile App to confirm your sign in...");
return Task.FromResult(true);
}
}

@ -513,7 +513,7 @@ namespace DepotDownloader
Username = logonDetails.Username,
Password = logonDetails.Password,
IsPersistentSession = ContentDownloader.Config.RememberPassword,
Authenticator = new UserConsoleAuthenticator(),
Authenticator = new DepotDownloaderAuthenticator(),
});
}
catch (TaskCanceledException)

Loading…
Cancel
Save