shapeshift / web

ShapeShift Web
https://app.shapeshift.com
MIT License
173 stars 190 forks source link

Handle multiple Ledgers and account management #6814

Open woodenfurniture opened 7 months ago

woodenfurniture commented 7 months ago

Overview

The ledger device ID is the same for every device, meaning query cache using wallet deviceId will be invalid if a different ledger is connected.

References and additional details

Originally noted here : https://github.com/shapeshift/web/pull/6780#discussion_r1588979619

Acceptance Criteria

Account management operates as intended across different ledger devices for all states and user flows.

SPIKE:

  1. can we auto open (and close / re-open) apps on ledger devices
  2. if so, this can be implemented in both connection / pairing flow and also to confirm device identity
  3. if not, lazy check of device identity on next wallet interaction (confirming account 0 matches expected account 0). If doesn't match prompt user. If match no action, proceed.

research #1 and create needed follow up tickets for 2 and 3 depending on out come.

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

woodenfurniture commented 6 months ago

Ledger does not ship with a uniquely identifiable serial number on the device - they are all 0001 (privacy reasons possibly?).

Regardless, it seems storing account configuration keyed by wallet device ID is not desirable because its possible for a user to wipe their device and reinitialize with totally different seed, which when reconnected would have accountIds configured which do not exist for the device. This may not matter as far as account balances etc, since those accountIds wont be accessible by the device so will not appear in-app (we'd have to verify this is the case), but the configured chainIds that are visible throughout the app would have to check what accounts are actually accessible at runtime so as not to display a chainId for an account that is not longer accessible by the device corresponding to the device ID.

We may want to try one of the following:

For reference, this is whats available for a given ledger device:

Image

woodenfurniture commented 6 months ago

To spike:

We can use the first connected account ID for each connected chain to detect if the wallet has changed since the seed it tied to the account derivation.

If the user connects a ledger, ask them to open one of the connectd apps, check the account ID matches, then conditionally proceed or push them into a new connect chains flow.

woodenfurniture commented 6 months ago
  1. Add band-aid text saying something like "Multiple ledger devices are currently not supported, click here to clear your cache" but nicer text
  2. Fast follow with solution
woodenfurniture commented 6 months ago

Relates to https://github.com/shapeshift/web/issues/6970

woodenfurniture commented 3 months ago
  1. can we auto open (and close / re-open) apps on ledger devices
  2. if so, this can be implemented in both connection / pairing flow and also to confirm device identity
  3. if not, lazy check of device identity on next wallet interaction (confirming account 0 matches expected account 0). If doesn't match prompt user. If match no action, proceed.
  1. ✅ completed in #7638
  2. ❌ not possible
  3. 🔄 in progress - https://github.com/shapeshift/web/pull/7639 fixes the trade page. We need this on the remaining pages
woodenfurniture commented 2 months ago

Remaining work - implement #7639 on other pages