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

Do not require additional newline prompting a hex seed #2192

Merged
merged 1 commit into from Nov 9, 2022

Conversation

jrick
Copy link
Member

@jrick jrick commented Nov 9, 2022

We currently require an extra blank line following the seed during creation of a restored wallet. This is due to two factors:

  • During creation of a new wallet, we print the seed in PGP word list encoding using multiple lines, and users copy and paste this as is, newlines included. This means our prompt must support reading multiple lines of input.

  • Because the seed length is not required to be exactly 32 bytes (33 words), we don't know when to stop prompting for seed words that are split across multiple lines. An extra blank line after the seed is used to stop the prompting.

This prompting behavior is only needed for seeds encoded with the PGP word list, and not seeds encoded in hex. If the first line of input is valid hex encoding, stop prompting immediately and do not require the additional blank line following the seed.

We currently require an extra blank line following the seed during
creation of a restored wallet.  This is due to two factors:

* During creation of a new wallet, we print the seed in PGP word list
  encoding using multiple lines, and users copy and paste this as is,
  newlines included.  This means our prompt must support reading
  multiple lines of input.

* Because the seed length is not required to be exactly 32 bytes (33
  words), we don't know when to stop prompting for seed words that are
  split across multiple lines.  An extra blank line after the seed is
  used to stop the prompting.

This prompting behavior is only needed for seeds encoded with the PGP
word list, and not seeds encoded in hex.  If the first line of input
is valid hex encoding, stop prompting immediately and do not require
the additional blank line following the seed.
@davecgh
Copy link
Member

davecgh commented Nov 9, 2022

Code seems correct, but I'm fairly certain it will break existing automation like the various simnet creation scripts in dcrd, dcrdex, etc.

@jrick
Copy link
Member Author

jrick commented Nov 9, 2022

I don't think so. The seed is always the final thing prompted for. Any input after it stops prompting earlier now will be discarded. I'm also not concerned with breaking expect due to the prompt text changing because, well, it doesn't work at all right now, and this is meant to change that.

@davecgh
Copy link
Member

davecgh commented Nov 9, 2022

Ah, I didn't know it would discard the extra input. That makes sense though and I agree it will be fine then.

EDIT: Regarding expect, that will still probably have the same issue when providing the seed via words instead of the hex though.

@jrick jrick merged commit f31e848 into decred:master Nov 9, 2022
@jrick jrick deleted the hexseedprompt branch November 9, 2022 17:12
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.

None yet

2 participants