-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathConsoleAuthenticator.cs
42 lines (33 loc) · 1.35 KB
/
ConsoleAuthenticator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Threading.Tasks;
using Spectre.Console;
using SteamKit2.Authentication;
namespace SteamTokenDumper;
internal sealed class ConsoleAuthenticator : IAuthenticator
{
/// <inheritdoc />
public Task<string> GetDeviceCodeAsync(bool previousCodeWasIncorrect)
{
if (previousCodeWasIncorrect)
{
AnsiConsole.MarkupLine("[red]The previous two-factor auth code you have provided is incorrect.[/]");
}
var code = AnsiConsole.Ask<string>("[green][bold]STEAM GUARD![/][/] Enter your two-factor code from your authenticator app:").Trim();
return Task.FromResult(code);
}
/// <inheritdoc />
public Task<string> GetEmailCodeAsync(string email, bool previousCodeWasIncorrect)
{
if (previousCodeWasIncorrect)
{
AnsiConsole.MarkupLine("[red]The previous two-factor auth code you have provided is incorrect.[/]");
}
var code = AnsiConsole.Ask<string>($"[green][bold]STEAM GUARD![/][/] Please enter the auth code sent to the email at {Markup.Escape(email)}:").Trim();
return Task.FromResult(code);
}
/// <inheritdoc />
public Task<bool> AcceptDeviceConfirmationAsync()
{
AnsiConsole.MarkupLine("[green][bold]STEAM GUARD![/][/] Use the Steam Mobile App to confirm your sign in...");
return Task.FromResult(true);
}
}