Skip to content

Commit

Permalink
Merge f731c4d into 6167501
Browse files Browse the repository at this point in the history
  • Loading branch information
carlaKC committed Jul 15, 2019
2 parents 6167501 + f731c4d commit 9c0563c
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions cmd/lncli/commands.go
Expand Up @@ -1539,47 +1539,54 @@ mnemonicCheck:
// want to use, we'll generate a fresh one with the GenSeed
// command.
fmt.Println("Your cipher seed can optionally be encrypted.")
fmt.Printf("Input your passphrase if you wish to encrypt it " +
"(or press enter to proceed without a cipher seed " +
"passphrase): ")
aezeedPass1, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
return err
}
fmt.Println()

if len(aezeedPass1) != 0 {
for {
fmt.Printf("Input your passphrase if you wish to encrypt it " +
"(or press enter to proceed without a cipher seed " +
"passphrase): ")
aezeedPass, err = terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
return err
}
fmt.Println()

// Do not require users to repeat passphrase
// if they are not using one.
if len(aezeedPass) == 0 {
break
}

fmt.Printf("Confirm cipher seed passphrase: ")
aezeedPass2, err := terminal.ReadPassword(
aezeedPassConfirmed, err := terminal.ReadPassword(
int(syscall.Stdin),
)
if err != nil {
return err
}
fmt.Println()

// If the passwords don't match, then we'll return an
// error.
if !bytes.Equal(aezeedPass1, aezeedPass2) {
return fmt.Errorf("cipher seed pass phrases " +
"don't match")
if bytes.Equal(aezeedPass, aezeedPassConfirmed) {
break
}

fmt.Printf("cipher seed pass phrases " +
"don't match, please try again")
fmt.Println()
}

fmt.Println()
fmt.Println("Generating fresh cipher seed...")
fmt.Println()

genSeedReq := &lnrpc.GenSeedRequest{
AezeedPassphrase: aezeedPass1,
AezeedPassphrase: aezeedPass,
}
seedResp, err := client.GenSeed(ctxb, genSeedReq)
if err != nil {
return fmt.Errorf("unable to generate seed: %v", err)
}

cipherSeedMnemonic = seedResp.CipherSeedMnemonic
aezeedPass = aezeedPass1
}

// Before we initialize the wallet, we'll display the cipher seed to
Expand Down

0 comments on commit 9c0563c

Please sign in to comment.