-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathConsoleAuthenticator.cs
More file actions
48 lines (38 loc) · 1.59 KB
/
ConsoleAuthenticator.cs
File metadata and controls
48 lines (38 loc) · 1.59 KB
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
43
44
45
46
47
48
using System.Threading.Tasks;
using Spectre.Console;
using SteamKit2.Authentication;
namespace SteamTokenDumper;
internal sealed class ConsoleAuthenticator(bool SkipDeviceConfirmation) : IAuthenticator
{
/// <inheritdoc />
public async Task<string> GetDeviceCodeAsync(bool previousCodeWasIncorrect)
{
if (previousCodeWasIncorrect)
{
AnsiConsole.MarkupLine("[red]The previous two-factor auth code you have provided is incorrect.[/]");
}
var code = await AnsiConsole.AskAsync<string>("[green][bold]STEAM GUARD![/][/] Enter your two-factor code from your authenticator app:");
return code.Trim();
}
/// <inheritdoc />
public async 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 = await AnsiConsole.AskAsync<string>($"[green][bold]STEAM GUARD![/][/] Please enter the auth code sent to the email at {Markup.Escape(email)}:");
return code.Trim();
}
/// <inheritdoc />
public Task<bool> AcceptDeviceConfirmationAsync()
{
if (SkipDeviceConfirmation)
{
return Task.FromResult(false);
}
AnsiConsole.MarkupLine("[green][bold]STEAM GUARD![/][/] Use the Steam Mobile App to confirm your login...");
AnsiConsole.MarkupLine("If you want to enter a two-factor code instead, take a look at the config file.");
return Task.FromResult(true);
}
}