justinmoon / junction

UI For Using Hardware Wallets With Bitcoin Core
MIT License
60 stars 13 forks source link

Multiple devices of the same 'type' cannot be co-signers #35

Open ghost opened 5 years ago

ghost commented 5 years ago

Two Trezor 1 devices will show up with same name 'trezor'. Adding the first as a signer works, but adding the second as a signer will result in an exception.

This is because the inclusion check on the signers collection (junction.py, line 155) only takes name into account:

 if name in [signer.name for signer in self.signers]:
            raise JunctionError(f'Name "{name}" already taken')

and the client code sets the signer name (Wallet.tsx) to the device.type

await api.addSigner({
      wallet_name: this.props.activeWallet.name,
      signer_name: device.type,
      device_id: device.fingerprint,
    })
ghost commented 5 years ago

@justinmoon If I'm reading hwilib correctly, the fingerprint is derived from the xpub. If that's true it should be safe to use as a unique identifier in lookups. Later UX iterations could provide the ability for the user to alias the device.