bitbox02: implement get_soft_device_id so multisig runs more smoothly

Without it, if you have say a 1-of-2 multisig with two BitBox02s, you
would run into trouble if the first keystore would try to match to the
wrong inserted BitBox02 (wrong order, or the first one is not
inserted, etc. ).

With the soft device id, the device manager can figure it on its own
which keystore belongs to which connected bb02.
This commit is contained in:
Marko Bencun 2020-07-14 16:44:29 +02:00
parent 995250948a
commit 106688ea54
No known key found for this signature in database
GPG key ID: 804538928C37EAE8

View file

@ -85,6 +85,15 @@ class BitBox02Client(HardwareClientBase):
return False
return True
def get_soft_device_id(self) -> Optional[str]:
if self.handler is None:
# Can't do the pairing without the handler. This happens at wallet creation time, when
# listing the devices.
return None
if self.bitbox02_device is None:
self.pairing_dialog(wizard=False)
return self.bitbox02_device.root_fingerprint().hex()
def pairing_dialog(self, wizard: bool = True):
def pairing_step(code: str, device_response: Callable[[], bool]) -> bool:
msg = "Please compare and confirm the pairing code on your BitBox02:\n" + code