-
Notifications
You must be signed in to change notification settings - Fork 402
BIP39 Implementation #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
BIP39 Implementation #644
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e4a1ccf
MOVEONLY: Move bip39.rs to bip39/mod.rs
atalw df1ab5c
BIP39: Custom implementation
atalw 94189cf
BIP39: Add feature flags for mnemonic languages
atalw 044ce4a
BIP39: Verify checksum logic and new tests
vladimirfomene 8415e0b
.gitignore for vscode
evanlinjin 59f41dc
BIP39: Add own PBKFD2 implementation
evanlinjin f34a18a
BIP39: Performance and readability changes
evanlinjin 464a729
BIP39: Various fixes and new tests
evanlinjin 08e1cc9
BIP39: Remove potentially dangerous trait impls
evanlinjin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ Cargo.lock | |
|
||
*.swp | ||
.idea | ||
|
||
# IDE | ||
/.vscode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ use bdk::bitcoincore_rpc::RpcApi; | |
use bdk::blockchain::rpc::{Auth, RpcBlockchain, RpcConfig}; | ||
use bdk::blockchain::ConfigurableBlockchain; | ||
|
||
use bdk::keys::bip39::{Language, Mnemonic, WordCount}; | ||
use bdk::keys::bip39::MnemonicWithPassphrase; | ||
use bdk::keys::bip39::{Language, WordCount}; | ||
use bdk::keys::{DerivableKey, GeneratableKey, GeneratedKey}; | ||
|
||
use bdk::miniscript::miniscript::Segwitv0; | ||
|
@@ -217,13 +218,10 @@ fn main() -> Result<(), Box<dyn Error>> { | |
// private descriptors can be recreated from it. | ||
fn generate_random_ext_privkey() -> Result<impl DerivableKey<Segwitv0> + Clone, Box<dyn Error>> { | ||
// a Bip39 passphrase can be set optionally | ||
let password = Some("random password".to_string()); | ||
let password = "random password"; | ||
|
||
// Generate a random mnemonic, and use that to create a "DerivableKey" | ||
let mnemonic: GeneratedKey<_, _> = Mnemonic::generate((WordCount::Words12, Language::English)) | ||
.map_err(|e| e.expect("Unknown Error"))?; | ||
|
||
// `Ok(mnemonic)` would also work if there's no passphrase and it would | ||
// yield the same result as this construct with `password` = `None`. | ||
Ok((mnemonic, password)) | ||
let mnemonic_with_passphrase: GeneratedKey<_, _> = | ||
MnemonicWithPassphrase::generate((WordCount::Words12, Language::English, password))?; | ||
Ok(mnemonic_with_passphrase) | ||
Comment on lines
+224
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that there is a change in the examples, I believe this will affect users. Is it possible to implement the BIP in such a way that it doesn't change anything for users. |
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits:
.idea
is for IntelliJ. I don't know if it is necessary to have thatIDE
comment.