Browse Source

wizard: add non-hardened derivation path check for digital bitbox, re-add rescan button in choose hw device,

clear clipboard before confirming seed.
master
Sander van Grieken 2 years ago
parent
commit
4101946ff5
  1. 18
      electrum/gui/qt/wizard/wallet.py
  2. 4
      electrum/plugins/digitalbitbox/digitalbitbox.py
  3. 2
      electrum/plugins/hw_wallet/plugin.py
  4. 2
      electrum/plugins/trezor/qt.py

18
electrum/gui/qt/wizard/wallet.py

@ -498,6 +498,8 @@ class WCConfirmSeed(WizardComponent):
) )
self.layout().addLayout(self.slayout) self.layout().addLayout(self.slayout)
wizard.app.clipboard().clear()
def apply(self): def apply(self):
pass pass
@ -1072,15 +1074,28 @@ class WCChooseHWDevice(WizardComponent, Logger):
self.device_list.setLayout(self.device_list_layout) self.device_list.setLayout(self.device_list_layout)
self.choice_w = None self.choice_w = None
self.rescan_button = QPushButton(_('Rescan devices'))
self.rescan_button.clicked.connect(self.on_rescan)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(self.rescan_button)
hbox.addStretch(1)
self.layout().addWidget(self.error_l) self.layout().addWidget(self.error_l)
self.layout().addWidget(self.device_list) self.layout().addWidget(self.device_list)
self.layout().addStretch(1) self.layout().addStretch(1)
self.layout().addLayout(hbox)
self.layout().addStretch(1)
self.c_values = [] self.c_values = []
def on_ready(self): def on_ready(self):
self.scan_devices() self.scan_devices()
def on_rescan(self):
self.scan_devices()
def on_scan_failed(self, code, message): def on_scan_failed(self, code, message):
self.error_l.setText(message) self.error_l.setText(message)
self.error_l.setVisible(True) self.error_l.setVisible(True)
@ -1115,6 +1130,9 @@ class WCChooseHWDevice(WizardComponent, Logger):
if self.valid: if self.valid:
self.wizard.next_button.setFocus() self.wizard.next_button.setFocus()
else:
self.rescan_button.setFocus()
def failed_getting_device_infos(self, debug_msg, name, e): def failed_getting_device_infos(self, debug_msg, name, e):
# nonlocal debug_msg # nonlocal debug_msg

4
electrum/plugins/digitalbitbox/digitalbitbox.py

@ -120,6 +120,10 @@ class DigitalBitbox_Client(HardwareClientBase):
def get_xpub(self, bip32_path, xtype): def get_xpub(self, bip32_path, xtype):
assert xtype in self.plugin.SUPPORTED_XTYPES assert xtype in self.plugin.SUPPORTED_XTYPES
if is_all_public_derivation(bip32_path):
raise UserFacingException(_('This device does not reveal xpubs corresponding to non-hardened paths'))
reply = self._get_xpub(bip32_path) reply = self._get_xpub(bip32_path)
if reply: if reply:
xpub = reply['xpub'] xpub = reply['xpub']

2
electrum/plugins/hw_wallet/plugin.py

@ -38,6 +38,7 @@ from electrum.keystore import Xpub, Hardware_KeyStore
if TYPE_CHECKING: if TYPE_CHECKING:
import threading import threading
from electrum.plugin import DeviceInfo
from electrum.wallet import Abstract_Wallet from electrum.wallet import Abstract_Wallet
@ -272,6 +273,7 @@ class HardwareClientBase(ABC):
is constructed for the first time. 'd' is the dict that will be is constructed for the first time. 'd' is the dict that will be
passed to the keystore constructor. passed to the keystore constructor.
""" """
# TODO: this is only used by coldcard. determine if this needs to stay generalized
pass pass

2
electrum/plugins/trezor/qt.py

@ -423,7 +423,7 @@ class InitSettingsLayout(QVBoxLayout):
# no backup # no backup
self.cb_no_backup = None self.cb_no_backup = None
if method == TIM_NEW: if method == TIM_NEW:
self.cb_no_backup = QCheckBox(f'''{_('Enable seedless mode')}''') self.cb_no_backup = QCheckBox(_('Enable seedless mode'))
self.cb_no_backup.setChecked(False) self.cb_no_backup.setChecked(False)
if (model == '1' and fw_version >= (1, 7, 1) if (model == '1' and fw_version >= (1, 7, 1)
or model == 'T' and fw_version >= (2, 0, 9)): or model == 'T' and fw_version >= (2, 0, 9)):

Loading…
Cancel
Save