@@ -10,14 +10,11 @@ import (
1010 "path"
1111 "strings"
1212 "syscall"
13- "time"
1413
1514 "github.com/btcsuite/btcd/chaincfg"
1615 "github.com/btcsuite/btclog"
17- "github.com/btcsuite/btcutil/hdkeychain"
1816 "github.com/guggero/chantools/dataformat"
1917 "github.com/jessevdk/go-flags"
20- "github.com/lightningnetwork/lnd/aezeed"
2118 "github.com/lightningnetwork/lnd/build"
2219 "github.com/lightningnetwork/lnd/chanbackup"
2320 "github.com/lightningnetwork/lnd/channeldb"
@@ -201,59 +198,6 @@ func readInput(input string) ([]byte, error) {
201198 return ioutil .ReadFile (input )
202199}
203200
204- func rootKeyFromConsole () (* hdkeychain.ExtendedKey , time.Time , error ) {
205- // We'll now prompt the user to enter in their 24-word mnemonic.
206- fmt .Printf ("Input your 24-word mnemonic separated by spaces: " )
207- reader := bufio .NewReader (os .Stdin )
208- mnemonicStr , err := reader .ReadString ('\n' )
209- if err != nil {
210- return nil , time .Unix (0 , 0 ), err
211- }
212-
213- // We'll trim off extra spaces, and ensure the mnemonic is all
214- // lower case, then populate our request.
215- mnemonicStr = strings .TrimSpace (mnemonicStr )
216- mnemonicStr = strings .ToLower (mnemonicStr )
217-
218- cipherSeedMnemonic := strings .Split (mnemonicStr , " " )
219-
220- fmt .Println ()
221-
222- if len (cipherSeedMnemonic ) != 24 {
223- return nil , time .Unix (0 , 0 ), fmt .Errorf ("wrong cipher seed " +
224- "mnemonic length: got %v words, expecting %v words" ,
225- len (cipherSeedMnemonic ), 24 )
226- }
227-
228- // Additionally, the user may have a passphrase, that will also
229- // need to be provided so the daemon can properly decipher the
230- // cipher seed.
231- fmt .Printf ("Input your cipher seed passphrase (press enter if " +
232- "your seed doesn't have a passphrase): " )
233- passphrase , err := terminal .ReadPassword (int (syscall .Stdin )) // nolint
234- if err != nil {
235- return nil , time .Unix (0 , 0 ), err
236- }
237- fmt .Println ()
238-
239- var mnemonic aezeed.Mnemonic
240- copy (mnemonic [:], cipherSeedMnemonic )
241-
242- // If we're unable to map it back into the ciphertext, then either the
243- // mnemonic is wrong, or the passphrase is wrong.
244- cipherSeed , err := mnemonic .ToCipherSeed (passphrase )
245- if err != nil {
246- return nil , time .Unix (0 , 0 ), fmt .Errorf ("failed to decrypt " +
247- "seed with passphrase: %v" , err )
248- }
249- rootKey , err := hdkeychain .NewMaster (cipherSeed .Entropy [:], chainParams )
250- if err != nil {
251- return nil , time .Unix (0 , 0 ), fmt .Errorf ("failed to derive " +
252- "master extended key" )
253- }
254- return rootKey , cipherSeed .BirthdayTime (), nil
255- }
256-
257201func passwordFromConsole (userQuery string ) ([]byte , error ) {
258202 // Read from terminal (if there is one).
259203 if terminal .IsTerminal (int (syscall .Stdin )) { // nolint
0 commit comments