lncli: add commands "create" and "unlock"

lncli create:
This command is used to set up a wallet encryption password for
use with lnd at first time use. It will ask fot the user to
confirm the chosen password, then do a call to the lnd RPC method
CreateWallet with the chosen password.

lncli unlock:
This command is used to unlock the wallet of a running lnd instance.
It calls the RPC method UnlockWallet with the provided password.

Both methods makes use of the terminal.ReadPassword method, to
securely read a password from user input without making it
replayable in the terminal.
This commit is contained in:
Johan T. Halseth authored and Olaoluwa Osuntokun committed 2017-10-19 19:17:35 -07:00
1 parent 2c2d18ee10
commit 00ee3afab8
2 files changed
+82

No files matched your search

+12
View File
@@ -34,6 +34,16 @@ func fatal(err error) {
os.Exit(1)
}
func getWalletUnlockerClient(ctx *cli.Context) (lnrpc.WalletUnlockerClient, func()) {
conn := getClientConn(ctx)
cleanUp := func() {
conn.Close()
}
return lnrpc.NewWalletUnlockerClient(conn), cleanUp
}
func getClient(ctx *cli.Context) (lnrpc.LightningClient, func()) {
conn := getClientConn(ctx)
@@ -146,6 +156,8 @@ func main() {
},
}
app.Commands = []cli.Command{
createCommand,
unlockCommand,
newAddressCommand,
sendManyCommand,
sendCoinsCommand,