MutinyWallet / mutiny-node

SDK behind Mutiny Wallet
https://mutinywallet.com
MIT License
187 stars 33 forks source link

Support BIP-39 passphrase #403

Open benthecarman opened 1 year ago

benthecarman commented 1 year ago

Currently we just hard coded an empty string as the passphrase, we could allow the user to set this.

This will need to be correctly set when creating the keys manager, bdk, wallet, and auth manager.

A good follow on would be to unify some logic so we aren't having this duplicate code in multiple places.

AbhinavMir commented 1 year ago

Happy to take this on. Can you point out to where this takes place? I tried looking at keygenerator but just want to be sure.

benthecarman commented 1 year ago

Happy to take this on. Can you point out to where this takes place? I tried looking at keygenerator but just want to be sure.

There's a few places where we call mnemonic.to_seed(""). You'll want to switch out the "" to a parameter and find everywhere we call it and make sure we use that bip39 passphrase. It should probably be an optional string and we can just default to the empty string if it is None

Here's one place https://github.com/MutinyWallet/mutiny-node/blob/master/mutiny-core/src/lib.rs#L127

AbhinavMir commented 1 year ago

Sorry for the delay, had some work come up. How can I test this? Any unit tests in place I could use?

benthecarman commented 1 year ago

https://github.com/MutinyWallet/mutiny-node/blob/3e8a0d114f7c59738137371fa3a8cfaed637e5e0/mutiny-core/src/keymanager.rs#L257

this test should break if you have a bip39 passphrase set

AbhinavMir commented 4 months ago

I thought I had a PR raised for this, but I must've forgot! Fixing this now!