bitpay / bitcore-mnemonic

BIP39 Mnemonics implemented for Bitcore
http://bitcore.io
MIT License
155 stars 212 forks source link

Should there be a "Mnemonic.fromHDPrivateKey()" #15

Closed throughnothing closed 8 years ago

throughnothing commented 9 years ago

If you've already generated a bitcore.HDPrivateKey(), should there be a way to pass it into Mnemonic to get the mnemonic phrase for it. It doesn't seem like you can do that currently, you have to generate the HDPrivateKey with Mnemonic.

Giszmo commented 9 years ago

The Mnemonic needs the wordlist as an additional input. Also HDPrivateKey.fromSeed() looks pretty one-way thanks to a hash function.

nilnullzip commented 8 years ago

Not possible. The mnemonic sentence is hashed to arrive at the seed that is used to generate the HDPrivateKey. So no way to go backwards.

https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki

This issue should be closed.

throughnothing commented 8 years ago

@nilnullzip thanks, that definitely makes sense, I didn't realize that. So wallets that enable you to see the mnemonic seed if/when you want, have to store that mnemonic data separately, in addition to the Private Key (or re-generate the key from the mnemonic every load).