Skip to content

feat: add 'gnokey add -entropy' #4586

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

moul
Copy link
Member

@moul moul commented Jul 29, 2025

Demo:

$  gnokey add -entropy test-entropy                                                                                                                                                                                                                                     
Enter a passphrase to encrypt your key to disk:                                                                                                                                                                                                                                                   
Repeat the passphrase:                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                  
=== MANUAL ENTROPY GENERATION ===                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                  
Provide at least 160 bits of entropy from a true random source:                                                                                                                                                                                                                                   
- Dice: 38+ d20 rolls (e.g., 18 7 3 12 5 19 8 2 14 11...)                                                                                                                                                                                                                                         
- Coins: 160+ flips (e.g., HTTHHTTHHHTTHHTHTTHHTHHT...)                                                                                                                                                                                                                                           
- Cards: 31+ draws (e.g., 7H 2C KS 9D 4H JS QC 3S...)                                                                                                                                                                                                                                             
- Other: keyboard mashing, environmental noise, etc.                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                  
Enter your entropy (any length, will be hashed with SHA-256):                                                                                                                                                                                                                                     
laskjdg asoidjg asoidjg asoidgj asodigj asdoigjas dogijasd                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                  
Derived entropy (SHA-256): a6d263b1a0c170181b4ce29868c15fba...                                                                                                                                                                                                                                    
Input length: 58 characters                                                                                                                                                                                                                                                                       
Generate mnemonic from this entropy? [y/n]:                                                                                                                                                                                                                                                       
y                                                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                  
* test-entropy (local) - addr: g1h3kgs6rrva9jfe43nxymdc8w8tpzm790ylfdes pub: gpub1pgfj7ard9eg82cjtv4u4xetrwqer2dntxyfzxz3pqtkjt02zvn4g6l5j2vgc0rthrhy8gpv0hndwmwy0tpkch2rd2vxejycdttd, path: <nil>                                                                                                
                                                                                                                                                                                                                                                                                                  
**IMPORTANT** write this mnemonic phrase in a safe place.                                                                                                                                                                                                                                         
It is the only way to recover your account if you ever forget your password.                                                                                                                                                                                                                      
plug narrow unaware dose blade army honey ordinary observe ecology fitness injury blind explain gain wife junior squirrel walnut machine worry lens loyal lock

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jul 29, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: moul/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

Copy link

codecov bot commented Jul 29, 2025

Signed-off-by: moul <[email protected]>
@moul moul requested review from jaekwon, aeddi and zivkovicmilos July 29, 2025 01:58
@moul moul marked this pull request as ready for review July 29, 2025 02:36
@moul
Copy link
Member Author

moul commented Jul 29, 2025

fyi, I am currently writing a txtar. However, due to the lack of stdin, I am considering adding stdin support to txtar or allowing the specification of entropy as a flag.

@github-actions github-actions bot added the 🐹 golang Pull requests that update Go code label Jul 30, 2025
@Kouteki Kouteki moved this from Triage to In Review in 🧙‍♂️gno.land core team Jul 30, 2025
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Looks good 💯

Left minor comments 🙏

moul added 3 commits July 30, 2025 14:50
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
@moul
Copy link
Member Author

moul commented Jul 31, 2025

@gfanton i’ve also updated the txtar engine, can you give a look please?

@moul moul requested a review from gfanton July 31, 2025 11:51
Copy link
Contributor

@aeddi aeddi left a comment

Choose a reason for hiding this comment

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

This idea is really cool! 👍

I would be curious to see a comparison between mouse movements (like on VeraCrypt, for example) and this dice-throwing method, measuring the time / "quality of the entropy" ratio generated in both cases (a lot more data produced in the case of mouse movements but more "pure" randomness in the case of dice-rolling).

@moul
Copy link
Member Author

moul commented Aug 4, 2025

Mouse-related concepts are difficult to verify, so no one verifies them. These concepts are essentially gray.
PRNG blind trust is black. Verifiable real-life entropy is white.

I prefer that people choose any method while being aware that they have the option to select the most verifiable one available. We will also share a guide for airgap computers using this method to ensure that the setup is correct (e.g., using legitimate dice, etc.).

Signed-off-by: moul <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤝 contribs 🐹 golang Pull requests that update Go code 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Status: In Progress
Status: 📥 Inbox
Status: In Review
Development

Successfully merging this pull request may close these issues.

4 participants