Add functions to Daemon
MODIFY
WalletWasabi.Gui/CommandLine/Daemon.cs
WalletWasabi.Gui/CommandLine/Daemon.cs
@@ -33,6 +33,7 @@ namespace WalletWasabi.Gui.CommandLine
string password = null;
var count = 3;
+ string compatibilityPassword = null;
do
{
if (password != null)
@@ -51,9 +52,22 @@ namespace WalletWasabi.Gui.CommandLine
Console.Write("Password: ");
password = PasswordConsole.ReadPassword();
- password = Guard.Correct(password);
+ if (PasswordHelper.IsTooLong(password, out password))
+ {
+ Console.WriteLine(PasswordHelper.PasswordTooLongMessage);
+ }
+ if (PasswordHelper.IsTrimable(password, out password))
+ {
+ Console.WriteLine(PasswordHelper.TrimmedMessage);
+ }
+ }
+ while (!PasswordHelper.TryPassword(keyManager, password, out compatibilityPassword));
+
+ if (compatibilityPassword != null)
+ {
+ password = compatibilityPassword;
+ Logger.LogInfo(PasswordHelper.CompatibilityPasswordWarnMessage);
}
- while (!keyManager.TestPassword(password));
Logger.LogInfo("Correct password.");

MODIFY
WalletWasabi.Gui/Controls/NoparaPasswordBox.cs
WalletWasabi.Gui/Controls/NoparaPasswordBox.cs
@@ -397,7 +397,7 @@ namespace WalletWasabi.Gui.Controls
password = trimmedPassword;
Sb.Clear();
Sb.Append(password);
- _ = DisplayWarningAsync("Leading and trailing white spaces were removed!");
+ _ = DisplayWarningAsync(PasswordHelper.TrimmedMessage);
}
Text = _displayText.Substring(0, password.Length);

MODIFY
WalletWasabi/Helpers/PasswordHelper.cs
WalletWasabi/Helpers/PasswordHelper.cs
@@ -15,6 +15,7 @@ namespace WalletWasabi.Helpers
public const int MaxPasswordLength = 150;
public const string CompatibilityPasswordWarnMessage = "Compatibility password was used! Please consider generating a new wallet to ensure recoverability!";
public static string PasswordTooLongMessage = $"Password too long (Max {MaxPasswordLength} characters).";
+ public const string TrimmedMessage = "Leading and trailing white spaces were removed!";
public static string[] GetPossiblePasswords(string originalPassword)
{

MODIFY
WalletWasabi/KeyManagement/KeyManager.cs
WalletWasabi/KeyManagement/KeyManager.cs
@@ -581,19 +581,6 @@ namespace WalletWasabi.KeyManagement
}
}
- public bool TestPassword(string password)
- {
- try
- {
- GetMasterExtKey(password);
- return true;
- }
- catch
- {
- return false;
- }
- }
-
/// <summary>
/// Make sure there's always clean keys generated and indexed.
/// Call SetMinGapLimit() to set how many keys should be asserted.

Add functions to Daemon