Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn and prompt for password before showing wallet keys #6021

Merged
merged 1 commit into from Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ shared.ok=OK
shared.yes=Yes
shared.no=No
shared.iUnderstand=I understand
shared.continueAnyway=Continue anyway
shared.na=N/A
shared.shutDown=Shut down
shared.reportBug=Report bug on GitHub
Expand Down Expand Up @@ -1842,7 +1843,10 @@ account.seed.restore.info=Please make a backup before applying restore from seed
had many transactions. Please avoid interrupting that process, otherwise you might need to delete the SPV chain file \
again or repeat the restore process.
account.seed.restore.ok=Ok, do the restore and shut down Bisq

account.keys.clipboard.warning=Please note that wallet private keys are highly sensitive financial data.\n\n\
● You should NOT divulge any of your keys to any individual who asks for them, unless you are absolutely certain that they are to be trusted handling your money! \n\n\
● You should NOT copy private key data to the clipboard unless you are absolutely certain that you are running a secure computing environment that has no malware risks. \n\n\
Many people have lost their Bitcoin this way. If you have ANY doubts, close this dialog immediately and seek assistance from someone knowledgeable.

####################################################################
# Mobile notifications
Expand Down
5 changes: 4 additions & 1 deletion desktop/src/main/java/bisq/desktop/app/BisqApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import bisq.desktop.main.overlays.windows.ManualPayoutTxWindow;
import bisq.desktop.main.overlays.windows.SendAlertMessageWindow;
import bisq.desktop.main.overlays.windows.ShowWalletDataWindow;
import bisq.desktop.main.overlays.windows.WalletPasswordWindow;
import bisq.desktop.util.CssTheme;
import bisq.desktop.util.ImageUtil;

Expand Down Expand Up @@ -336,7 +337,9 @@ private void addSceneKeyEventHandler(Scene scene, Injector injector) {
} else if (Utilities.isAltOrCtrlPressed(KeyCode.J, keyEvent)) {
WalletsManager walletsManager = injector.getInstance(WalletsManager.class);
if (walletsManager.areWalletsAvailable())
new ShowWalletDataWindow(walletsManager).show();
new ShowWalletDataWindow(walletsManager,
injector.getInstance(BtcWalletService.class),
injector.getInstance(WalletPasswordWindow.class)).show();
else
new Popup().warning(Res.get("popup.warning.walletNotInitialized")).show();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.G, keyEvent)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.desktop.common.view.FxmlView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.ShowWalletDataWindow;
import bisq.desktop.main.overlays.windows.WalletPasswordWindow;
import bisq.desktop.util.Layout;

import bisq.core.btc.listeners.BalanceListener;
Expand Down Expand Up @@ -59,6 +60,7 @@ public class WalletInfoView extends ActivatableView<GridPane, Void> {
private final WalletsManager walletsManager;
private final BtcWalletService btcWalletService;
private final BsqWalletService bsqWalletService;
private final WalletPasswordWindow walletPasswordWindow;
private final CoinFormatter btcFormatter;
private final BsqFormatter bsqFormatter;
private int gridRow = 0;
Expand All @@ -76,11 +78,13 @@ public class WalletInfoView extends ActivatableView<GridPane, Void> {
private WalletInfoView(WalletsManager walletsManager,
BtcWalletService btcWalletService,
BsqWalletService bsqWalletService,
WalletPasswordWindow walletPasswordWindow,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter,
BsqFormatter bsqFormatter) {
this.walletsManager = walletsManager;
this.btcWalletService = btcWalletService;
this.bsqWalletService = bsqWalletService;
this.walletPasswordWindow = walletPasswordWindow;
this.btcFormatter = btcFormatter;
this.bsqFormatter = bsqFormatter;
}
Expand Down Expand Up @@ -130,7 +134,7 @@ protected void activate() {

openDetailsButton.setOnAction(e -> {
if (walletsManager.areWalletsAvailable()) {
new ShowWalletDataWindow(walletsManager).width(root.getWidth()).show();
new ShowWalletDataWindow(walletsManager, btcWalletService, walletPasswordWindow).width(root.getWidth()).show();
} else {
new Popup().warning(Res.get("popup.warning.walletNotInitialized")).show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
package bisq.desktop.main.overlays.windows;

import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.main.overlays.popups.Popup;

import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.WalletsManager;
import bisq.core.locale.Res;

import bisq.common.UserThread;
import bisq.common.util.Tuple2;
import bisq.common.util.Utilities;

Expand All @@ -39,18 +42,42 @@

public class ShowWalletDataWindow extends Overlay<ShowWalletDataWindow> {
private final WalletsManager walletsManager;
private final BtcWalletService btcWalletService;
private final WalletPasswordWindow walletPasswordWindow;


///////////////////////////////////////////////////////////////////////////////////////////
// Public API
///////////////////////////////////////////////////////////////////////////////////////////

public ShowWalletDataWindow(WalletsManager walletsManager) {
public ShowWalletDataWindow(WalletsManager walletsManager,
BtcWalletService btcWalletService,
WalletPasswordWindow walletPasswordWindow) {
this.walletsManager = walletsManager;
this.btcWalletService = btcWalletService;
this.walletPasswordWindow = walletPasswordWindow;
type = Type.Attention;
}

public void show() {
UserThread.execute(() -> {
new Popup().warning(Res.get("account.keys.clipboard.warning"))
.actionButtonText(Res.get("shared.continueAnyway"))
.onClose(this::doClose)
.onAction(this::showStep2)
.show();
});
}

private void showStep2() {
if (btcWalletService.isEncrypted()) {
UserThread.execute(() -> walletPasswordWindow.onAesKey(aesKey -> showStep3()).show());
} else {
showStep3();
}
}

private void showStep3() {
if (headLine == null)
headLine = Res.get("showWalletDataWindow.walletData");

Expand Down