BitBoxSwiss / bitbox02-firmware

Firmware code of the BitBox02 hardware wallet
https://bitbox.swiss/bitbox02
Apache License 2.0
217 stars 81 forks source link

keystore: derive bip86 pubkey from xpub, not from xprv #1029

Closed benma closed 1 year ago

benma commented 1 year ago

Before we used a shared helper function that computes the bip86 keypair for both getting the pubkey as well as signing, as the priv/pubkeys get tweaked with the same tweak.

We might want to implement xpub caching to not re-derive xpubs from the seed more than needed (e.g. when loading many inputs in a BTC transaction), in which case we must be able to derive the bip86 pubkey from an xpub alone, not from an xprv.