Skip to content
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

feat: write out results of tested seed phrase reconstruction to txt file #8

Merged
merged 4 commits into from
Jul 21, 2024

Conversation

mgrotheer
Copy link
Contributor

@mgrotheer mgrotheer commented Jul 19, 2024

While the double_check_shares() function does ensure that the original seed phrase can be reconstructed for any t shares, it doesn't display the results to the user (it only shows Ok/Fail). So if someone wants to validate this themselves, they will need to manually via the cargo run reconstruct... command. This can be fairly time-consuming and error prone depending on how many combinations there are. If someone wants to test a 2 of 4 reconstruction for all combinations, it will take quite a while.

This change updates that function to output each n of m combination that is tested and then writes out the results to a file called reconstructed_seed_phrases.txt. For example, using the example from the README: cargo run --features double-check split -t 2 -n 3 --secret "permit universe parent weapon amused modify essay borrow tobacco budget walnut lunch consider gallery ride amazing frog forget treat market chapter velvet useless topple", then the content of the txt file are automatically populated with the following:

Original seed phrase:
"permit universe parent weapon amused modify essay borrow tobacco budget walnut lunch consider gallery ride amazing frog forget treat market chapter velvet useless topple"

Reconstructed seed phrase from combination 1:
  Share 1: "health attract purpose load weasel brother vague laundry utility zero olive word portion interest clock thrive stove present bar endless distance input quick pool"
  Share 2: "clown cloth royal artwork true pride drama stem shift supply gym exhibit candy apology odor head figure faint entry credit staff leg enroll skirt"
  Reconstructed seed phrase:
    "permit universe parent weapon amused modify essay borrow tobacco budget walnut lunch consider gallery ride amazing frog forget treat market chapter velvet useless topple"

Reconstructed seed phrase from combination 2:
  Share 1: "health attract purpose load weasel brother vague laundry utility zero olive word portion interest clock thrive stove present bar endless distance input quick pool"
  Share 3: "topic silver real jealous boring decide zero real stove desk agent daughter play camp arctic mind talk pass safe verb soccer wheat behind letter"
  Reconstructed seed phrase:
    "permit universe parent weapon amused modify essay borrow tobacco budget walnut lunch consider gallery ride amazing frog forget treat market chapter velvet useless topple"

Reconstructed seed phrase from combination 3:
  Share 2: "clown cloth royal artwork true pride drama stem shift supply gym exhibit candy apology odor head figure faint entry credit staff leg enroll skirt"
  Share 3: "topic silver real jealous boring decide zero real stove desk agent daughter play camp arctic mind talk pass safe verb soccer wheat behind letter"
  Reconstructed seed phrase:
    "permit universe parent weapon amused modify essay borrow tobacco budget walnut lunch consider gallery ride amazing frog forget treat market chapter velvet useless topple"

Copy link
Owner

@asonnino asonnino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The changes look great. Could you fix the lints to pass the CI checks?

src/bip39.rs Outdated Show resolved Hide resolved
@mgrotheer mgrotheer changed the title Write out results of tested seed phrase reconstruction to txt file feat: write out results of tested seed phrase reconstruction to txt file Jul 20, 2024
@mgrotheer
Copy link
Contributor Author

updated PR title format

@mgrotheer
Copy link
Contributor Author

Resolved linting issues

@asonnino asonnino merged commit 1ae976e into asonnino:main Jul 21, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants