Make USE_DEV_PRIVILEGE_KEYS flag configurable

This commit is contained in:
Bernard Labno 2018-02-21 12:49:42 +01:00
parent d377eec122
commit 051694dfdb
22 changed files with 144 additions and 67 deletions

View File

@ -4,13 +4,11 @@ public class DevEnv {
// Was used for P2P network stress test to adjust several setting for the tests (e.g. use lower btc fees for offers,..)
public static final boolean STRESS_TEST_MODE = false;
// If that is true all the privileged features which requires a private key to enable it are overridden by a dev ey pair.
// The UI got set the private dev key so the developer does not need to do anything and can test those features.
// Features: Arbitration registration (alt+R at account), Alert/Update (alt+m), private message to a
// peer (click user icon and alt+r), filter/block offers by various data like offer ID (cmd + f).
// The user can set a program argument to ignore all of those privileged network_messages. They are intended for
// emergency cases only (beside update message and arbitrator registration).
public static final boolean USE_DEV_PRIVILEGE_KEYS = false;
public static final String DEV_PRIVILEGE_PUB_KEY = "027a381b5333a56e1cc3d90d3a7d07f26509adf7029ed06fc997c656621f8da1ee";
public static final String DEV_PRIVILEGE_PRIV_KEY = "6ac43ea1df2a290c1c8391736aa42e4339c5cb4f110ff0257a13b63211977b7a";

View File

@ -49,10 +49,7 @@ public class AlertManager {
private final ObjectProperty<Alert> alertMessageProperty = new SimpleObjectProperty<>();
// Pub key for developer global alert message
@SuppressWarnings("ConstantConditions")
private static final String pubKeyAsHex = DevEnv.USE_DEV_PRIVILEGE_KEYS ?
DevEnv.DEV_PRIVILEGE_PUB_KEY :
"036d8a1dfcb406886037d2381da006358722823e1940acc2598c844bbc0fd1026f";
private final String pubKeyAsHex;
private ECKey alertSigningKey;
@ -61,7 +58,11 @@ public class AlertManager {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public AlertManager(P2PService p2PService, KeyRing keyRing, User user, @Named(AppOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
public AlertManager(P2PService p2PService,
KeyRing keyRing,
User user,
@Named(AppOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
this.p2PService = p2PService;
this.keyRing = keyRing;
this.user = user;
@ -88,6 +89,9 @@ public class AlertManager {
}
});
}
pubKeyAsHex = useDevPrivilegeKeys ?
DevEnv.DEV_PRIVILEGE_PUB_KEY :
"036d8a1dfcb406886037d2381da006358722823e1940acc2598c844bbc0fd1026f";
}

View File

@ -50,10 +50,7 @@ public class PrivateNotificationManager {
private final ObjectProperty<PrivateNotificationPayload> privateNotificationMessageProperty = new SimpleObjectProperty<>();
// Pub key for developer global privateNotification message
@SuppressWarnings("ConstantConditions")
private static final String pubKeyAsHex = DevEnv.USE_DEV_PRIVILEGE_KEYS ?
DevEnv.DEV_PRIVILEGE_PUB_KEY :
"02ba7c5de295adfe57b60029f3637a2c6b1d0e969a8aaefb9e0ddc3a7963f26925";
private final String pubKeyAsHex;
private ECKey privateNotificationSigningKey;
private DecryptedMessageWithPubKey decryptedMessageWithPubKey;
@ -64,7 +61,10 @@ public class PrivateNotificationManager {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public PrivateNotificationManager(P2PService p2PService, KeyRing keyRing, @Named(AppOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
public PrivateNotificationManager(P2PService p2PService,
KeyRing keyRing,
@Named(AppOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
this.p2PService = p2PService;
this.keyRing = keyRing;
@ -72,6 +72,9 @@ public class PrivateNotificationManager {
this.p2PService.addDecryptedDirectMessageListener(this::handleMessage);
this.p2PService.addDecryptedMailboxListener(this::handleMessage);
}
pubKeyAsHex = useDevPrivilegeKeys ?
DevEnv.DEV_PRIVILEGE_PUB_KEY :
"02ba7c5de295adfe57b60029f3637a2c6b1d0e969a8aaefb9e0ddc3a7963f26925";
}
private void handleMessage(DecryptedMessageWithPubKey decryptedMessageWithPubKey, NodeAddress senderNodeAddress) {

View File

@ -8,4 +8,5 @@ public class AppOptionKeys {
public static final String MAX_MEMORY = "maxMemory";
public static final String DUMP_STATISTICS = "dumpStatistics";
public static final String IGNORE_DEV_MSG_KEY = "ignoreDevMsg";
public static final String USE_DEV_PRIVILEGE_KEYS = "useDevPrivilegeKeys";
}

View File

@ -177,7 +177,7 @@ public class BisqEnvironment extends StandardEnvironment {
@Getter
protected List<String> bannedSeedNodes, bannedBtcNodes, bannedPriceRelayNodes;
protected final String btcNodes, seedNodes, ignoreDevMsg, useTorForBtc, rpcUser, rpcPassword,
protected final String btcNodes, seedNodes, ignoreDevMsg, useDevPrivilegeKeys, useTorForBtc, rpcUser, rpcPassword,
rpcPort, rpcBlockNotificationPort, dumpBlockchainData, fullDaoNode,
myAddress, banList, dumpStatistics, maxMemory, socks5ProxyBtcAddress,
socks5ProxyHttpAddress, useAllProvidedNodes, numConnectionForBtc, regTestBsqGenesisTxId;
@ -212,6 +212,9 @@ public class BisqEnvironment extends StandardEnvironment {
ignoreDevMsg = commandLineProperties.containsProperty(AppOptionKeys.IGNORE_DEV_MSG_KEY) ?
(String) commandLineProperties.getProperty(AppOptionKeys.IGNORE_DEV_MSG_KEY) :
"";
useDevPrivilegeKeys = commandLineProperties.containsProperty(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) ?
(String) commandLineProperties.getProperty(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) :
"";
dumpStatistics = commandLineProperties.containsProperty(AppOptionKeys.DUMP_STATISTICS) ?
(String) commandLineProperties.getProperty(AppOptionKeys.DUMP_STATISTICS) :
"";
@ -403,6 +406,7 @@ public class BisqEnvironment extends StandardEnvironment {
setProperty(AppOptionKeys.APP_DATA_DIR_KEY, appDataDir);
setProperty(AppOptionKeys.IGNORE_DEV_MSG_KEY, ignoreDevMsg);
setProperty(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS, useDevPrivilegeKeys);
setProperty(AppOptionKeys.DUMP_STATISTICS, dumpStatistics);
setProperty(AppOptionKeys.APP_NAME_KEY, appName);
setProperty(AppOptionKeys.MAX_MEMORY, maxMemory);

View File

@ -124,6 +124,11 @@ public abstract class BisqExecutable {
"(Global alert, Version update alert, Filters for offers, nodes or trading account data)", false))
.withRequiredArg()
.ofType(boolean.class);
parser.accepts(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS,
description("If that is true all the privileged features which requires a private key to enable it are overridden by a dev key pair " +
"(This is for developers only!)", false))
.withRequiredArg()
.ofType(boolean.class);
parser.accepts(AppOptionKeys.DUMP_STATISTICS,
description("If set to true the trade statistics are stored as json file in the data dir.", false))
.withRequiredArg()

View File

@ -18,6 +18,7 @@
package io.bisq.core.arbitration;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import io.bisq.common.Timer;
import io.bisq.common.UserThread;
import io.bisq.common.app.DevEnv;
@ -25,6 +26,7 @@ import io.bisq.common.crypto.KeyRing;
import io.bisq.common.handlers.ErrorMessageHandler;
import io.bisq.common.handlers.ResultHandler;
import io.bisq.common.util.Utilities;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.filter.FilterManager;
import io.bisq.core.user.Preferences;
import io.bisq.core.user.User;
@ -63,26 +65,7 @@ public class ArbitratorManager {
private static final long RETRY_REPUBLISH_SEC = 5;
private static final long REPEATED_REPUBLISH_AT_STARTUP_SEC = 60;
@SuppressWarnings("ConstantConditions")
private static final List<String> publicKeys = DevEnv.USE_DEV_PRIVILEGE_KEYS ?
new ArrayList<>(Collections.singletonList(DevEnv.DEV_PRIVILEGE_PUB_KEY)) :
new ArrayList<>(Arrays.asList(
"0365c6af94681dbee69de1851f98d4684063bf5c2d64b1c73ed5d90434f375a054",
"031c502a60f9dbdb5ae5e438a79819e4e1f417211dd537ac12c9bc23246534c4bd",
"02c1e5a242387b6d5319ce27246cea6edaaf51c3550591b528d2578a4753c56c2c",
"025c319faf7067d9299590dd6c97fe7e56cd4dac61205ccee1cd1fc390142390a2",
"038f6e24c2bfe5d51d0a290f20a9a657c270b94ef2b9c12cd15ca3725fa798fc55",
"0255256ff7fb615278c4544a9bbd3f5298b903b8a011cd7889be19b6b1c45cbefe",
"024a3a37289f08c910fbd925ebc72b946f33feaeff451a4738ee82037b4cda2e95",
"02a88b75e9f0f8afba1467ab26799dcc38fd7a6468fb2795444b425eb43e2c10bd",
"02349a51512c1c04c67118386f4d27d768c5195a83247c150a4b722d161722ba81",
"03f718a2e0dc672c7cdec0113e72c3322efc70412bb95870750d25c32cd98de17d",
"028ff47ee2c56e66313928975c58fa4f1b19a0f81f3a96c4e9c9c3c6768075509e",
"02b517c0cbc3a49548f448ddf004ed695c5a1c52ec110be1bfd65fa0ca0761c94b",
"03df837a3a0f3d858e82f3356b71d1285327f101f7c10b404abed2abc1c94e7169",
"0203a90fb2ab698e524a5286f317a183a84327b8f8c3f7fa4a98fec9e1cefd6b72",
"023c99cc073b851c892d8c43329ca3beb5d2213ee87111af49884e3ce66cbd5ba5"
));
private final List<String> publicKeys;
///////////////////////////////////////////////////////////////////////////////////////////
// Instance fields
@ -103,12 +86,36 @@ public class ArbitratorManager {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public ArbitratorManager(KeyRing keyRing, ArbitratorService arbitratorService, User user, Preferences preferences, FilterManager filterManager) {
public ArbitratorManager(KeyRing keyRing,
ArbitratorService arbitratorService,
User user,
Preferences preferences,
FilterManager filterManager,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
this.keyRing = keyRing;
this.arbitratorService = arbitratorService;
this.user = user;
this.preferences = preferences;
this.filterManager = filterManager;
publicKeys = useDevPrivilegeKeys ?
Collections.unmodifiableList(Collections.singletonList(DevEnv.DEV_PRIVILEGE_PUB_KEY)) :
Collections.unmodifiableList(Arrays.asList(
"0365c6af94681dbee69de1851f98d4684063bf5c2d64b1c73ed5d90434f375a054",
"031c502a60f9dbdb5ae5e438a79819e4e1f417211dd537ac12c9bc23246534c4bd",
"02c1e5a242387b6d5319ce27246cea6edaaf51c3550591b528d2578a4753c56c2c",
"025c319faf7067d9299590dd6c97fe7e56cd4dac61205ccee1cd1fc390142390a2",
"038f6e24c2bfe5d51d0a290f20a9a657c270b94ef2b9c12cd15ca3725fa798fc55",
"0255256ff7fb615278c4544a9bbd3f5298b903b8a011cd7889be19b6b1c45cbefe",
"024a3a37289f08c910fbd925ebc72b946f33feaeff451a4738ee82037b4cda2e95",
"02a88b75e9f0f8afba1467ab26799dcc38fd7a6468fb2795444b425eb43e2c10bd",
"02349a51512c1c04c67118386f4d27d768c5195a83247c150a4b722d161722ba81",
"03f718a2e0dc672c7cdec0113e72c3322efc70412bb95870750d25c32cd98de17d",
"028ff47ee2c56e66313928975c58fa4f1b19a0f81f3a96c4e9c9c3c6768075509e",
"02b517c0cbc3a49548f448ddf004ed695c5a1c52ec110be1bfd65fa0ca0761c94b",
"03df837a3a0f3d858e82f3356b71d1285327f101f7c10b404abed2abc1c94e7169",
"0203a90fb2ab698e524a5286f317a183a84327b8f8c3f7fa4a98fec9e1cefd6b72",
"023c99cc073b851c892d8c43329ca3beb5d2213ee87111af49884e3ce66cbd5ba5"
));
}
public void shutDown() {

View File

@ -18,7 +18,9 @@
package io.bisq.core.arbitration;
import com.google.inject.Singleton;
import com.google.inject.name.Names;
import io.bisq.common.app.AppModule;
import io.bisq.core.app.AppOptionKeys;
import org.springframework.core.env.Environment;
public class ArbitratorModule extends AppModule {
@ -28,6 +30,8 @@ public class ArbitratorModule extends AppModule {
@Override
protected final void configure() {
Boolean useDevPrivilegeKeys = environment.getProperty(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS, Boolean.class, false);
bind(boolean.class).annotatedWith(Names.named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS)).toInstance(useDevPrivilegeKeys);
bind(ArbitratorManager.class).in(Singleton.class);
bind(DisputeManager.class).in(Singleton.class);
bind(ArbitratorService.class).in(Singleton.class);

View File

@ -81,10 +81,7 @@ public class FilterManager {
private final ObjectProperty<Filter> filterProperty = new SimpleObjectProperty<>();
private final List<Listener> listeners = new ArrayList<>();
@SuppressWarnings("ConstantConditions")
private static final String pubKeyAsHex = DevEnv.USE_DEV_PRIVILEGE_KEYS ?
DevEnv.DEV_PRIVILEGE_PUB_KEY :
"022ac7b7766b0aedff82962522c2c14fb8d1961dabef6e5cfd10edc679456a32f1";
private final String pubKeyAsHex;
private ECKey filterSigningKey;
@ -99,7 +96,8 @@ public class FilterManager {
Preferences preferences,
BisqEnvironment bisqEnvironment,
ProvidersRepository providersRepository,
@Named(AppOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
@Named(AppOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
this.p2PService = p2PService;
this.keyRing = keyRing;
this.user = user;
@ -107,6 +105,9 @@ public class FilterManager {
this.bisqEnvironment = bisqEnvironment;
this.providersRepository = providersRepository;
this.ignoreDevMsg = ignoreDevMsg;
pubKeyAsHex = useDevPrivilegeKeys ?
DevEnv.DEV_PRIVILEGE_PUB_KEY :
"022ac7b7766b0aedff82962522c2c14fb8d1961dabef6e5cfd10edc679456a32f1";
}
public void onAllServicesInitialized() {

View File

@ -21,6 +21,8 @@ import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.name.Names;
import io.bisq.common.CommonOptionKeys;
import io.bisq.common.UserThread;
import io.bisq.common.app.Capabilities;
@ -325,7 +327,8 @@ public class BisqApp extends Application {
private void showSendAlertMessagePopup() {
AlertManager alertManager = injector.getInstance(AlertManager.class);
new SendAlertMessageWindow()
boolean useDevPrivilegeKeys = injector.getInstance(Key.get(Boolean.class, Names.named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS)));
new SendAlertMessageWindow(useDevPrivilegeKeys)
.onAddAlertMessage(alertManager::addAlertMessageIfKeyIsValid)
.onRemoveAlertMessage(alertManager::removeAlertMessageIfKeyIsValid)
.show();
@ -333,7 +336,8 @@ public class BisqApp extends Application {
private void showFilterPopup() {
FilterManager filterManager = injector.getInstance(FilterManager.class);
new FilterWindow(filterManager)
boolean useDevPrivilegeKeys = injector.getInstance(Key.get(Boolean.class, Names.named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS)));
new FilterWindow(filterManager, useDevPrivilegeKeys)
.onAddFilter(filterManager::addFilterMessageIfKeyIsValid)
.onRemoveFilter(filterManager::removeFilterMessageIfKeyIsValid)
.show();

View File

@ -43,7 +43,8 @@ public class PeerInfoIcon extends Group {
Offer offer,
Preferences preferences,
AccountAgeWitnessService accountAgeWitnessService,
BSFormatter formatter) {
BSFormatter formatter,
boolean useDevPrivilegeKeys) {
this.numTrades = numTrades;
hostName = nodeAddress != null ? nodeAddress.getHostName() : "";
@ -156,7 +157,7 @@ public class PeerInfoIcon extends Group {
formatter.formatAccountAge(makersAccountAge) :
Res.get("peerInfo.unknownAge") :
null;
setOnMouseClicked(e -> new PeerInfoWithTagEditor(privateNotificationManager, offer, preferences)
setOnMouseClicked(e -> new PeerInfoWithTagEditor(privateNotificationManager, offer, preferences, useDevPrivilegeKeys)
.hostName(hostName)
.numTrades(numTrades)
.accountAge(accountAgeTagEditor)

View File

@ -18,10 +18,12 @@
package io.bisq.gui.main.account.arbitratorregistration;
import com.google.inject.name.Named;
import io.bisq.common.UserThread;
import io.bisq.common.locale.LanguageUtil;
import io.bisq.common.locale.Res;
import io.bisq.common.util.Tuple2;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.arbitration.Arbitrator;
import io.bisq.gui.common.view.ActivatableViewAndModel;
import io.bisq.gui.common.view.FxmlView;
@ -50,6 +52,7 @@ import static io.bisq.gui.util.FormBuilder.*;
@FxmlView
public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, ArbitratorRegistrationViewModel> {
private final boolean useDevPrivilegeKeys;
private ListView<String> languagesListView;
private ComboBox<String> languageComboBox;
@ -65,8 +68,9 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, Ar
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private ArbitratorRegistrationView(ArbitratorRegistrationViewModel model) {
private ArbitratorRegistrationView(ArbitratorRegistrationViewModel model, @Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(model);
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
}
@Override
@ -94,7 +98,7 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, Ar
updateLanguageList();
if (model.registrationPubKeyAsHex.get() == null && unlockArbitrationRegistrationWindow == null) {
unlockArbitrationRegistrationWindow = new UnlockArbitrationRegistrationWindow();
unlockArbitrationRegistrationWindow = new UnlockArbitrationRegistrationWindow(useDevPrivilegeKeys);
unlockArbitrationRegistrationWindow.onClose(() -> unlockArbitrationRegistrationWindow = null)
.onKey(model::setPrivKeyAndCheckPubKey)
.width(700)

View File

@ -17,8 +17,10 @@
package io.bisq.gui.main.disputes.arbitrator;
import com.google.inject.name.Named;
import io.bisq.common.crypto.KeyRing;
import io.bisq.core.alert.PrivateNotificationManager;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.arbitration.DisputeManager;
import io.bisq.core.trade.TradeManager;
import io.bisq.gui.common.view.FxmlView;
@ -40,10 +42,10 @@ public class ArbitratorDisputeView extends TraderDisputeView {
BSFormatter formatter, DisputeSummaryWindow disputeSummaryWindow,
PrivateNotificationManager privateNotificationManager,
ContractWindow contractWindow, TradeDetailsWindow tradeDetailsWindow,
P2PService p2PService) {
P2PService p2PService, @Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(disputeManager, keyRing, tradeManager, stage, formatter,
disputeSummaryWindow, privateNotificationManager, contractWindow,
tradeDetailsWindow, p2PService);
tradeDetailsWindow, p2PService, useDevPrivilegeKeys);
}
@Override

View File

@ -19,6 +19,7 @@ package io.bisq.gui.main.disputes.trader;
import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import com.google.inject.name.Named;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import io.bisq.common.Timer;
@ -29,6 +30,7 @@ import io.bisq.common.crypto.PubKeyRing;
import io.bisq.common.locale.Res;
import io.bisq.common.util.Utilities;
import io.bisq.core.alert.PrivateNotificationManager;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.arbitration.Attachment;
import io.bisq.core.arbitration.Dispute;
import io.bisq.core.arbitration.DisputeManager;
@ -103,6 +105,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
private final P2PService p2PService;
private final List<Attachment> tempAttachments = new ArrayList<>();
private final boolean useDevPrivilegeKeys;
private TableView<Dispute> tableView;
private SortedList<Dispute> sortedList;
@ -147,7 +150,8 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
PrivateNotificationManager privateNotificationManager,
ContractWindow contractWindow,
TradeDetailsWindow tradeDetailsWindow,
P2PService p2PService) {
P2PService p2PService,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
this.disputeManager = disputeManager;
this.keyRing = keyRing;
this.tradeManager = tradeManager;
@ -158,6 +162,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
this.contractWindow = contractWindow;
this.tradeDetailsWindow = tradeDetailsWindow;
this.p2PService = p2PService;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
}
@Override
@ -315,7 +320,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
else
nodeAddress = selectedDispute.getContract().getSellerNodeAddress();
new SendPrivateNotificationWindow(pubKeyRing, nodeAddress)
new SendPrivateNotificationWindow(pubKeyRing, nodeAddress, useDevPrivilegeKeys)
.onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid)
.show();
}

View File

@ -17,12 +17,14 @@
package io.bisq.gui.main.offer.offerbook;
import com.google.inject.name.Named;
import io.bisq.common.locale.FiatCurrency;
import io.bisq.common.locale.Res;
import io.bisq.common.locale.TradeCurrency;
import io.bisq.common.monetary.Price;
import io.bisq.common.monetary.Volume;
import io.bisq.core.alert.PrivateNotificationManager;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.offer.Offer;
import io.bisq.core.offer.OfferPayload;
import io.bisq.core.payment.PaymentAccount;
@ -78,6 +80,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
private final OfferDetailsWindow offerDetailsWindow;
private final BSFormatter formatter;
private final PrivateNotificationManager privateNotificationManager;
private final boolean useDevPrivilegeKeys;
private ComboBox<TradeCurrency> currencyComboBox;
private ComboBox<PaymentMethod> paymentMethodComboBox;
@ -101,14 +104,19 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
OfferBookView(OfferBookViewModel model, Navigation navigation, OfferDetailsWindow offerDetailsWindow, BSFormatter formatter,
PrivateNotificationManager privateNotificationManager) {
OfferBookView(OfferBookViewModel model,
Navigation navigation,
OfferDetailsWindow offerDetailsWindow,
BSFormatter formatter,
PrivateNotificationManager privateNotificationManager,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(model);
this.navigation = navigation;
this.offerDetailsWindow = offerDetailsWindow;
this.formatter = formatter;
this.privateNotificationManager = privateNotificationManager;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
}
@Override
@ -858,7 +866,8 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
offer,
model.preferences,
model.accountAgeWitnessService,
formatter);
formatter,
useDevPrivilegeKeys);
setGraphic(peerInfoIcon);
} else {
setGraphic(null);

View File

@ -38,6 +38,7 @@ import java.util.function.Consumer;
@Slf4j
public class PeerInfoWithTagEditor extends Overlay<PeerInfoWithTagEditor> {
private final boolean useDevPrivilegeKeys;
private InputTextField inputTextField;
private Point2D position;
private static PeerInfoWithTagEditor INSTANCE;
@ -52,10 +53,11 @@ public class PeerInfoWithTagEditor extends Overlay<PeerInfoWithTagEditor> {
@Nullable
private String accountAge;
public PeerInfoWithTagEditor(PrivateNotificationManager privateNotificationManager, Offer offer, Preferences preferences) {
public PeerInfoWithTagEditor(PrivateNotificationManager privateNotificationManager, Offer offer, Preferences preferences, boolean useDevPrivilegeKeys) {
this.privateNotificationManager = privateNotificationManager;
this.offer = offer;
this.preferences = preferences;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
width = 400;
type = Type.Undefined;
if (INSTANCE != null)
@ -163,7 +165,7 @@ public class PeerInfoWithTagEditor extends Overlay<PeerInfoWithTagEditor> {
keyEventEventHandler = event -> {
if (Utilities.isAltOrCtrlPressed(KeyCode.R, event)) {
new SendPrivateNotificationWindow(offer.getPubKeyRing(), offer.getMakerNodeAddress())
new SendPrivateNotificationWindow(offer.getPubKeyRing(), offer.getMakerNodeAddress(), useDevPrivilegeKeys)
.onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid)
.show();
}

View File

@ -48,6 +48,7 @@ public class FilterWindow extends Overlay<FilterWindow> {
private SendFilterMessageHandler sendFilterMessageHandler;
private RemoveFilterMessageHandler removeFilterMessageHandler;
private final FilterManager filterManager;
private final boolean useDevPrivilegeKeys;
///////////////////////////////////////////////////////////////////////////////////////////
@ -66,8 +67,9 @@ public class FilterWindow extends Overlay<FilterWindow> {
// Public API
///////////////////////////////////////////////////////////////////////////////////////////
public FilterWindow(FilterManager filterManager) {
public FilterWindow(FilterManager filterManager, boolean useDevPrivilegeKeys) {
this.filterManager = filterManager;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
type = Type.Attention;
}
@ -113,7 +115,7 @@ public class FilterWindow extends Overlay<FilterWindow> {
private void addContent() {
InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("shared.unlock"), 10).second;
if (DevEnv.USE_DEV_PRIVILEGE_KEYS)
if (useDevPrivilegeKeys)
keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);
InputTextField offerIdsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.offers")).second;

View File

@ -38,6 +38,7 @@ import javafx.scene.layout.HBox;
import static io.bisq.gui.util.FormBuilder.*;
public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
private final boolean useDevPrivilegeKeys;
private SendAlertMessageHandler sendAlertMessageHandler;
private RemoveAlertMessageHandler removeAlertMessageHandler;
@ -58,7 +59,8 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
// Public API
///////////////////////////////////////////////////////////////////////////////////////////
public SendAlertMessageWindow() {
public SendAlertMessageWindow(boolean useDevPrivilegeKeys) {
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
type = Type.Attention;
}
@ -105,7 +107,7 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
private void addContent() {
InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex,
Res.get("shared.unlock"), 10).second;
if (DevEnv.USE_DEV_PRIVILEGE_KEYS)
if (useDevPrivilegeKeys)
keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);
Tuple2<Label, TextArea> labelTextAreaTuple2 = addLabelTextArea(gridPane, ++rowIndex,

View File

@ -47,6 +47,7 @@ public class SendPrivateNotificationWindow extends Overlay<SendPrivateNotificati
private final PubKeyRing pubKeyRing;
private final NodeAddress nodeAddress;
private final boolean useDevPrivilegeKeys;
private SendPrivateNotificationHandler sendPrivateNotificationHandler;
@ -66,9 +67,10 @@ public class SendPrivateNotificationWindow extends Overlay<SendPrivateNotificati
///////////////////////////////////////////////////////////////////////////////////////////
public SendPrivateNotificationWindow(PubKeyRing pubKeyRing, NodeAddress nodeAddress) {
public SendPrivateNotificationWindow(PubKeyRing pubKeyRing, NodeAddress nodeAddress, boolean useDevPrivilegeKeys) {
this.pubKeyRing = pubKeyRing;
this.nodeAddress = nodeAddress;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
type = Type.Attention;
}
@ -110,7 +112,7 @@ public class SendPrivateNotificationWindow extends Overlay<SendPrivateNotificati
private void addContent() {
InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex,
Res.get("shared.unlock"), 10).second;
if (DevEnv.USE_DEV_PRIVILEGE_KEYS)
if (useDevPrivilegeKeys)
keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);
Tuple2<Label, TextArea> labelTextAreaTuple2 = addLabelTextArea(gridPane, ++rowIndex,

View File

@ -34,6 +34,7 @@ import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
public class UnlockArbitrationRegistrationWindow extends Overlay<UnlockArbitrationRegistrationWindow> {
private final boolean useDevPrivilegeKeys;
private Button unlockButton;
private InputTextField keyInputTextField;
private PrivKeyHandler privKeyHandler;
@ -53,7 +54,8 @@ public class UnlockArbitrationRegistrationWindow extends Overlay<UnlockArbitrati
// Public API
///////////////////////////////////////////////////////////////////////////////////////////
public UnlockArbitrationRegistrationWindow() {
public UnlockArbitrationRegistrationWindow(boolean useDevPrivilegeKeys) {
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
if (keyInputTextField != null)
keyInputTextField.textProperty().addListener(changeListener);
@ -111,7 +113,7 @@ public class UnlockArbitrationRegistrationWindow extends Overlay<UnlockArbitrati
GridPane.setRowIndex(label, ++rowIndex);
keyInputTextField = new InputTextField();
if (DevEnv.USE_DEV_PRIVILEGE_KEYS)
if (useDevPrivilegeKeys)
keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);
GridPane.setMargin(keyInputTextField, new Insets(3, 0, 0, 0));
GridPane.setRowIndex(keyInputTextField, rowIndex);

View File

@ -17,11 +17,13 @@
package io.bisq.gui.main.portfolio.closedtrades;
import com.google.inject.name.Named;
import com.googlecode.jcsv.writer.CSVEntryConverter;
import io.bisq.common.locale.Res;
import io.bisq.common.monetary.Price;
import io.bisq.common.monetary.Volume;
import io.bisq.core.alert.PrivateNotificationManager;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.offer.Offer;
import io.bisq.core.offer.OpenOffer;
import io.bisq.core.trade.Tradable;
@ -48,12 +50,12 @@ import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Callback;
import org.bitcoinj.core.Coin;
import sun.security.krb5.internal.rcache.AuthList;
import javax.inject.Inject;
@FxmlView
public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTradesViewModel> {
private final boolean useDevPrivilegeKeys;
@FXML
TableView<ClosedTradableListItem> tableView;
@FXML
@ -76,7 +78,8 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
TradeDetailsWindow tradeDetailsWindow,
PrivateNotificationManager privateNotificationManager,
Stage stage,
BSFormatter formatter) {
BSFormatter formatter,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(model);
this.offerDetailsWindow = offerDetailsWindow;
this.preferences = preferences;
@ -85,6 +88,7 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
this.stage = stage;
this.preferences = preferences;
this.formatter = formatter;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
}
@Override
@ -328,7 +332,8 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
offer,
preferences,
model.accountAgeWitnessService,
formatter);
formatter,
useDevPrivilegeKeys);
setPadding(new Insets(1, 0, 0, 0));
setGraphic(peerInfoIcon);
} else {

View File

@ -17,10 +17,12 @@
package io.bisq.gui.main.portfolio.pendingtrades;
import com.google.inject.name.Named;
import io.bisq.common.UserThread;
import io.bisq.common.locale.Res;
import io.bisq.common.util.Utilities;
import io.bisq.core.alert.PrivateNotificationManager;
import io.bisq.core.app.AppOptionKeys;
import io.bisq.core.offer.Offer;
import io.bisq.core.trade.Trade;
import io.bisq.core.user.Preferences;
@ -60,6 +62,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
private final TradeDetailsWindow tradeDetailsWindow;
private final BSFormatter formatter;
private final PrivateNotificationManager privateNotificationManager;
private final boolean useDevPrivilegeKeys;
@FXML
TableView<PendingTradesListItem> tableView;
@FXML
@ -80,12 +83,18 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public PendingTradesView(PendingTradesViewModel model, TradeDetailsWindow tradeDetailsWindow, BSFormatter formatter, PrivateNotificationManager privateNotificationManager, Preferences preferences) {
public PendingTradesView(PendingTradesViewModel model,
TradeDetailsWindow tradeDetailsWindow,
BSFormatter formatter,
PrivateNotificationManager privateNotificationManager,
Preferences preferences,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(model);
this.tradeDetailsWindow = tradeDetailsWindow;
this.formatter = formatter;
this.privateNotificationManager = privateNotificationManager;
this.preferences = preferences;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
}
@Override
@ -477,7 +486,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
offer,
preferences,
model.accountAgeWitnessService,
formatter);
formatter,
useDevPrivilegeKeys);
setPadding(new Insets(1, 0, 0, 0));
setGraphic(peerInfoIcon);
} else {