trezor / trezor-suite

Trezor Suite Monorepo
https://trezor.io/trezor-suite
Other
698 stars 246 forks source link

Validate xpub in onboarding flow #6683

Open mnuky opened 1 year ago

mnuky commented 1 year ago

As a user I would like to informed that I'm trying to import xPub which is not supported in order to avoid confusion that we support all xPubs.

Current supported assets: BTC and BTC testnet

Acceptance criteria: If I scan unsuported asset, I'll get message that this is not supported xPUB

Design in Figma: https://www.figma.com/file/Z6AGVUmKQzLNtDozFamW7f/branch/BlVnxNzUqrZkbhHgezLczh/s2-Mobile?node-id=5942%3A114265

juriczech commented 1 year ago

@mnuky Can you please provide some unsuported XPUB that we could use to be able to work on this?

mnuky commented 1 year ago

try this one, it is Dogecoin XPUB

Screenshot 2022-10-31 at 9 04 52
juriczech commented 1 year ago

@sime @mnuky Currently, I am not sure whether this is possible since we don't have xPub validator and connect just returns account from coin that I sent as parameter to getAccountInfo function.

sime commented 1 year ago

If there isn't a way to do this with connect: The format of xpub/ypub/zpub is a standard, so an external library will have to be employed to solve.

sime commented 1 year ago

What about the bip32 library. It has a fromBase58 method which throws for me when scanning dogecoin and litecoin. Bitcoin Cash is a false positive but perhaps that can be mitigated by the network parameter.

And it looks like it already used in this repo. https://www.npmjs.com/package/bip32