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

cmd: Add passphrase confirmation when creating wallet from existing seed #3303

Merged

Conversation

carlaKC
Copy link
Collaborator

@carlaKC carlaKC commented Jul 11, 2019

Require that users confirm their passphrase when providing their own seed with a passphrase.
Currently implemented as an infinite loop until passwords match, can be limited to a set number of retries if that's the UX wanted.

Fixes #1507

Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @carlaKC! The new logic looks good to me, but I think we should consider moving this into the branch where the seed is created (!hasMnemonic). When using an existing seed, that seed already has a chosen password so confirmation is not necessary, we are just trying to decrypt it. Currently when creating a seed if the passwords don't match on the first time, we'll exit. Adding this for loop there will make it easier if people mess up their first attempt.

@cfromknecht cfromknecht added authentication enhancement Improvements to existing features / behaviour lncli labels Jul 11, 2019
@carlaKC
Copy link
Collaborator Author

carlaKC commented Jul 15, 2019

Okay got it, I wasn't super clear on what needed to be done from the original issue, will update :)

While I'm at it, I'm wondering if it's worth adding similar password retry to creating the wallet password? Not sure if endless password loops everywhere are ideal, but adding it there would make the whole flow consistent?

@carlaKC carlaKC force-pushed the ckc-I1507-lnclipasswordretry branch from 3c6bb39 to f731c4d Compare July 15, 2019 14:37
@cfromknecht
Copy link
Contributor

@carlaKC sure that sounds great! should be able to reuse a good amount of code between the two :)

@carlaKC carlaKC force-pushed the ckc-I1507-lnclipasswordretry branch from f731c4d to 3ffa38e Compare July 17, 2019 13:27
Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

Nice cleanup! 😀

@@ -1650,6 +1612,50 @@ mnemonicCheck:
return nil
}

func capturePassword(instruction, noun string, optional bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

should have a godoc

cmd/lncli/commands.go Outdated Show resolved Hide resolved
cmd/lncli/commands.go Outdated Show resolved Hide resolved
cmd/lncli/commands.go Outdated Show resolved Hide resolved
@carlaKC carlaKC force-pushed the ckc-I1507-lnclipasswordretry branch from 3ffa38e to 21eefe6 Compare July 18, 2019 18:09
@cfromknecht cfromknecht self-requested a review July 18, 2019 22:37
Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

@carlaKC great refactor! 🏆

Code changes look solid, just have a few formatting comments and then should be good to go

cmd/lncli/commands.go Outdated Show resolved Hide resolved
cmd/lncli/commands.go Outdated Show resolved Hide resolved
@@ -1650,6 +1612,56 @@ mnemonicCheck:
return nil
}

// capturePassword returns a password value that has been
Copy link
Contributor

Choose a reason for hiding this comment

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

Excellent description! The line wrapping on the godoc looks like it breaks before 80 chars, but not a blocker

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!
I was wrapping at 72 because I remembered seeing it somewhere in the contributions guide. but that was for commit messages 🤦‍♀

@carlaKC carlaKC force-pushed the ckc-I1507-lnclipasswordretry branch from 21eefe6 to d5b662d Compare July 20, 2019 18:48
Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

LGTM 🕺


// If the password provided is not valid, restart
// password capture process from the beginning.
if err := validate(password); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call to do validation before asking to repeat! 😀

Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @carlaKC! 💯

@cfromknecht cfromknecht added this to the 0.7.1 milestone Jul 22, 2019
@cfromknecht cfromknecht merged commit b60825f into lightningnetwork:master Jul 22, 2019
@carlaKC carlaKC deleted the ckc-I1507-lnclipasswordretry branch February 16, 2020 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication enhancement Improvements to existing features / behaviour lncli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lncli should ask to repeat passphrase
3 participants