This commit is contained in:
Łukasz Domeradzki
2025-01-27 20:24:43 +01:00
parent dd37914703
commit 0a2ce30c82
2 changed files with 11 additions and 4 deletions

View File

@@ -63,6 +63,13 @@ public static class Utilities {
return collection.Select(static entry => entry);
}
[PublicAPI]
public static string AsMasked(this string text, char mask = '*') {
ArgumentNullException.ThrowIfNull(text);
return new string(mask, text.Length);
}
[PublicAPI]
public static string GenerateChecksumFor(byte[] source) {
ArgumentNullException.ThrowIfNull(source);

View File

@@ -106,7 +106,7 @@ internal static class Logging {
Console.Write(cryptKeyText);
result = ConsoleReadLineMasked();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result.AsMasked()));
break;
case ASF.EUserInputType.DeviceConfirmation:
@@ -145,7 +145,7 @@ internal static class Logging {
Console.Write(passwordText);
result = ConsoleReadLineMasked();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result.AsMasked()));
break;
case ASF.EUserInputType.SteamGuard:
@@ -167,7 +167,7 @@ internal static class Logging {
Console.Write(steamParentalCodeText);
result = ConsoleReadLineMasked();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result.AsMasked()));
break;
case ASF.EUserInputType.TwoFactorAuthentication:
@@ -178,7 +178,7 @@ internal static class Logging {
Console.Write(twoFactorAuthenticationText);
result = ConsoleReadLine();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result?.Length ?? 0)));
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result?.AsMasked()));
break;
default: