-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a major commit that introduces new functionality to encrypt the xud node key with a password which can also be used to encrypt lnd and (with a separate PR) Raiden. A new config option `noencrypt` is added and for now defaults to `true`, meaning that this functionality is off by default. This is to minimize disruption with existing applications of xud. When `noencrypt` is true, starting up xud occurs as it does before this PR. When `noencrypt` is false, we first check if there is an existing node key file saved to disk. If one exists, we wait to receive a new `UnlockNode` call to provide us with a password. We use this password to decrypt the node key file and to call `UnlockWallet` on each configured lnd instance that is waiting to be unlocked. If none is found, we wait to receive a new `CreateNode` call to provide us with a password. We then attempt to call `GenSeed` on a configured lnd instance to generate an aezeed 24 word mnemonic. We use this mnemonic to generate our node key, and then encrypt that with our password and save to disk. We then call `InitWallet` on each configured lnd instance that is waiting to be unlocked, using the same mnemonic and password from earlier steps. As part of this PR, we introduce a new grpc `XudInitService` for calls when xud is in a state of waiting for a password before it can complete initialization. New `create` and `unlock` commands are added for `xucli` as well. This is a major step towards #912.
- Loading branch information
Showing
32 changed files
with
1,657 additions
and
1,000 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Arguments } from 'yargs'; | ||
import { callback, loadXudInitClient } from '../command'; | ||
import { CreateNodeRequest } from '../../proto/xudrpc_pb'; | ||
|
||
export const command = 'create <password>'; | ||
|
||
export const describe = 'create an xud node'; | ||
|
||
export const builder = { | ||
password: { | ||
description: 'password to encrypt xud key and wallets', | ||
type: 'string', | ||
}, | ||
}; | ||
|
||
export const handler = (argv: Arguments) => { | ||
const request = new CreateNodeRequest(); | ||
request.setPassword(argv.password); | ||
loadXudInitClient(argv).createNode(request, callback(argv)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Arguments } from 'yargs'; | ||
import { callback, loadXudInitClient } from '../command'; | ||
import { UnlockNodeRequest } from '../../proto/xudrpc_pb'; | ||
|
||
export const command = 'unlock <password>'; | ||
|
||
export const describe = 'unlock an xud node'; | ||
|
||
export const builder = { | ||
password: { | ||
description: 'password to decrypt xud key and wallets', | ||
type: 'string', | ||
}, | ||
}; | ||
|
||
export const handler = (argv: Arguments) => { | ||
const request = new UnlockNodeRequest(); | ||
request.setPassword(argv.password); | ||
loadXudInitClient(argv).unlockNode(request, callback(argv)); | ||
}; |
Oops, something went wrong.