1
0

hw DeviceMgr: mostly switch away from xpubs for device pairing

- the DeviceMgr no longer uses xpubs to keep track of paired hw devices
- instead, introduce keystore.pairing_code(), based on soft_device_id
- xpubs are now only used in a single place when the actual pairing happens
- motivation is to allow pairing a single device with multiple generic
  output script descriptors, not just a single account-level xpub
- as a side-effect, we now allow pairing a device with multiple open
  windows simultaneously (if keystores have the same root fingerprint
  -- was already the case before if keystores had the same xpub)
This commit is contained in:
SomberNight
2022-12-19 08:19:19 +00:00
parent 8878059b2f
commit cea4238b81
5 changed files with 48 additions and 37 deletions

View File

@@ -915,6 +915,12 @@ class Hardware_KeyStore(Xpub, KeyStore):
self.soft_device_id = client.get_soft_device_id()
self.is_requesting_to_be_rewritten_to_wallet_file = True
def pairing_code(self) -> Optional[str]:
"""Used by the DeviceMgr to keep track of paired hw devices."""
if not self.soft_device_id:
return None
return f"{self.plugin.name}/{self.soft_device_id}"
KeyStoreWithMPK = Union[KeyStore, MasterPublicKeyMixin] # intersection really...
AddressIndexGeneric = Union[Sequence[int], str] # can be hex pubkey str