toggle sensitive data on advanced wallet info
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletInfoView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/WalletInfoView.xaml
xmlns:converters="clr-namespace:WalletWasabi.Gui.Converters;assembly=WalletWasabi.Gui">
<UserControl.Resources>
<converters:LurkingWifeModeStringConverter x:Key="LurkingWifeModeStringConverter" />
+ <converters:ShowHideSensitiveKeysBoolConverter x:Key="ShowHideSensitiveKeysBoolConverter" />
</UserControl.Resources>
<controls:GroupBox Title="{Binding Title}" BorderThickness="0" Classes="docTabContainer">
<StackPanel>
<StackPanel IsVisible="{Binding !IsWatchOnly}" Margin="0 10 0 0" Spacing="10" Orientation="Horizontal">
<controls:NoparaPasswordBox Password="{Binding Password}" Watermark="Password" UseFloatingWatermark="True" MinWidth="173" MaxWidth="173">
<i:Interaction.Behaviors>
- <behaviors:CommandOnEnterBehavior Command="{Binding ShowSensitiveKeysCommand}" />
+ <behaviors:CommandOnEnterBehavior Command="{Binding ToggleSensitiveKeysCommand}" />
</i:Interaction.Behaviors>
</controls:NoparaPasswordBox>
<DockPanel VerticalAlignment="Top" LastChildFill="True">
- <Button Command="{Binding ShowSensitiveKeysCommand}" DockPanel.Dock="Right">
- Show Sensitive Keys
- </Button>
+ <Button Content="{Binding IsShow, Converter={StaticResource ShowHideSensitiveKeysBoolConverter}}" Command="{Binding ToggleSensitiveKeysCommand}" DockPanel.Dock="Right"/>
<Grid></Grid>
</DockPanel>
<TextBlock Text="{Binding WarningMessage}" Classes="warningMessage" />

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletInfoViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletInfoViewModel.cs
@@ -17,6 +17,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
private CompositeDisposable Disposables { get; set; }
+ private bool _showSensitiveKeys;
private string _password;
private string _extendedMasterPrivateKey;
private string _extendedMasterZprv;
@@ -47,9 +48,15 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
});
- ShowSensitiveKeysCommand = ReactiveCommand.Create(() =>
+ ToggleSensitiveKeysCommand = ReactiveCommand.Create(() =>
{
try
+ {
+ if (IsShow)
+ {
+ ClearSensitiveData(true);
+ }
+ else
{
Password = Guard.Correct(Password);
var secret = KeyManager.GetMasterExtKey(Password);
@@ -61,6 +68,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
string accountZ = secret.Derive(KeyManager.AccountKeyPath).ToZPrv(Global.Network);
SetSensitiveData(master, account, masterZ, accountZ);
}
+ }
catch (Exception ex)
{
SetWarningMessage(ex.ToTypeMessageString());
@@ -74,6 +82,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ExtendedMasterZprv = "";
ExtendedAccountPrivateKey = "";
ExtendedAccountZprv = "";
+ IsShow = false;
if (passwordToo)
{
@@ -87,7 +96,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public string ExtendedAccountZpub => KeyManager.ExtPubKey.ToZpub(Global.Network);
public string AccountKeyPath => $"m/{KeyManager.AccountKeyPath.ToString()}";
public string MasterKeyFingerprint => KeyManager.MasterFingerprint.ToString();
- public ReactiveCommand<Unit, Unit> ShowSensitiveKeysCommand { get; }
+ public ReactiveCommand<Unit, Unit> ToggleSensitiveKeysCommand { get; }
+
+ public bool IsShow
+ {
+ get => _showSensitiveKeys;
+ set => this.RaiseAndSetIfChanged(ref _showSensitiveKeys, value);
+ }
public string Password
{
@@ -125,6 +140,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ExtendedAccountPrivateKey = extendedAccountPrivateKey;
ExtendedMasterZprv = extendedMasterZprv;
ExtendedAccountZprv = extendedAccountZprv;
+ IsShow = true;
Dispatcher.UIThread.PostLogException(async () =>
{

ADD
WalletWasabi.Gui/Converters/ShowHideSensitiveKeysBoolConverter.cs
+using Avalonia.Data.Converters;
+using System;
+using System.Globalization;
+
+namespace WalletWasabi.Gui.Converters
+{
+ public class ShowHideSensitiveKeysBoolConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is bool isShow)
+ {
+ return isShow ? "Hide Sensitive Keys" : "Show Sensitive Keys";
+ }
+ else
+ {
+ throw new TypeArgumentException(value, typeof(bool), nameof(value));
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+ }
+}

toggle sensitive data on advanced wallet info