name the device and its fingerprint when a connected device does not match the wallet keystores
What changed, and why it matters
This commit improves an on-screen message shown when a connected hardware wallet does not match the wallet being used. Instead of a generic 'No matching devices found' message, it now names the device and shows its fingerprint, helping the user check they plugged in the correct device and entered the right passphrase. There is no security vulnerability here; it is a usability and diagnostic improvement.
No security action required. Treat as a normal UX improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change collects devices whose fingerprints do not match the expected operation fingerprints, then updates the UI label to display the device model and fingerprint when exactly one mismatched device is present, or a pluralized message when multiple mismatched devices are present. It also adds text wrapping and padding to the label so the longer message displays correctly. No cryptographic, authorization, or input-handling logic is modified.
Changed components
src/main/java/com/sparrowwallet/sparrow/control/DeviceDialog.javaInspect captured patch +19 / −2
### src/main/java/com/sparrowwallet/sparrow/control/DeviceDialog.java
@@ -8,11 +8,13 @@
import com.sparrowwallet.sparrow.io.Hwi;
import javafx.application.Platform;
import javafx.event.ActionEvent;
+import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
+import javafx.scene.text.TextAlignment;
import org.controlsfx.glyphfont.Glyph;
import java.util.ArrayList;
@@ -55,9 +57,12 @@ public DeviceDialog(List<String> operationFingerprints) {
scanBox = new VBox();
scanBox.setSpacing(30);
scanBox.setAlignment(Pos.CENTER);
+ scanBox.setPadding(new Insets(0, 20, 0, 20));
Glyph usb = new Glyph(FontAwesome5Brands.FONT_NAME, FontAwesome5Brands.Glyph.USB);
usb.setFontSize(50);
scanLabel = new Label("Connect Hardware Wallet");
+ scanLabel.setWrapText(true);
+ scanLabel.setTextAlignment(TextAlignment.CENTER);
scanButton = new Button("Scan...");
scanButton.setPrefSize(120, 60);
scanButton.setOnAction(event -> {
@@ -126,9 +131,14 @@ protected void setDevices(List<Device> devices) {
List<Device> dialogDevices = new ArrayList<>(devices);
dialogDevices.removeIf(Objects::isNull);
+ List<Device> mismatchedDevices = new ArrayList<>();
if(operationFingerprints != null) {
dialogDevices.removeIf(device -> {
- return device.getFingerprint() != null && !operationFingerprints.contains(device.getFingerprint()) && !(device.isNeedsPinSent() || device.isNeedsPassphraseSent());
+ boolean mismatched = device.getFingerprint() != null && !operationFingerprints.contains(device.getFingerprint()) && !(device.isNeedsPinSent() || device.isNeedsPassphraseSent());
+ if(mismatched) {
+ mismatchedDevices.add(device);
+ }
+ return mismatched;
});
}
@@ -137,7 +147,14 @@ protected void setDevices(List<Device> devices) {
if(dialogDevices.isEmpty()) {
scanButton.setDefaultButton(true);
scanBox.setVisible(true);
- scanLabel.setText("No matching devices found");
+ if(mismatchedDevices.isEmpty() || operationFingerprints.isEmpty()) {
+ scanLabel.setText("No matching devices found");
+ } else if(mismatchedDevices.size() == 1) {
+ Device device = mismatchedDevices.getFirst();
+ scanLabel.setText(device.getModel().toDisplayString() + " found, but its fingerprint " + device.getFingerprint() + " does not match. Check this is the right device and the passphrase is correct.");
+ } else {
+ scanLabel.setText("Devices found, but their fingerprints do not match. Check these are the right devices and the passphrases are correct.");
+ }
} else {
scanBox.setVisible(false);
for(Device device : dialogDevices) {Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.