dicekeys / dicekeys-android

DiceKeys for Android
13 stars 1 forks source link

Prevent BIP39 generation if secret bytes are not multiple of 32bits #203

Closed angelix closed 1 year ago

angelix commented 2 years ago

From the BIP39 Spec

The mnemonic must encode entropy in a multiple of 32 bits.

If a recipe uses lengthinBytes the secret bytes may be not multiple of 32bits. In that case warn user about this limitation.

UppaJung commented 2 years ago

I'd suggest we only show the BIP39 option for secrets of size other than 32 bytes. (what we do in TypeScript now)

angelix commented 2 years ago

I suggest to show BIP39 options for 16 & 32 bytes. 16 bytes create a 12 word mnemonic, i think is the most common mnemonic size used by users.

UppaJung commented 2 years ago

The TypeScript implementation doesn't currently support that. It could. The question is, if users are using a DiceKey, would there be any reason for them to use the less secure option of 16 bytes? They're going to be generating a new BIP39 secret regardless.

If so, we'd probably want to add a new "Cryptocurrency wallet seed (small)" option or something like that.

angelix commented 2 years ago

It's easier to enter it on a sw/hw wallet, nothing else. Let's see if there are requests for it.