Validate Account keypath
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWallets/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWallets/RecoverWalletViewModel.cs
@@ -38,7 +38,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets
this.ValidateProperty(x => x.Password, ValidatePassword);
this.ValidateProperty(x => x.MinGapLimit, ValidateMinGapLimit);
- this.ValidateProperty(x => x.AccountKeyPath, ValidateKeyPath);
+ this.ValidateProperty(x => x.AccountKeyPath, ValidateAccountKeyPath);
MnemonicWords = "";
@@ -220,16 +220,24 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets
}
}
- private void ValidateKeyPath(IValidationErrors errors)
+ private void ValidateAccountKeyPath(IValidationErrors errors)
{
if (string.IsNullOrWhiteSpace(AccountKeyPath))
{
errors.Add(ErrorSeverity.Error, "Path is not valid.");
}
- else if (!KeyPath.TryParse(AccountKeyPath, out _))
+ else if (!KeyPath.TryParse(AccountKeyPath, out var keyPath))
{
errors.Add(ErrorSeverity.Error, "Path is not a valid derivation path.");
}
+ else
+ {
+ var accountKeyPath = keyPath.GetAccountKeyPath();
+ if (keyPath.Length != accountKeyPath.Length || accountKeyPath.Length != KeyManager.DefaultAccountKeyPath.Length)
+ {
+ errors.Add(ErrorSeverity.Error, "Path is a full account derivation path.");
+ }
+ }
}
}
}

Validate Account keypath