Added new proto files and fixed walletunlocker issues
This commit is contained in:
parent
7990b58026
commit
920f14a3fc
3 changed files with 1631 additions and 1385 deletions
2914
config/rpc.proto
2914
config/rpc.proto
File diff suppressed because it is too large
Load diff
|
|
@ -1,21 +1,16 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "google/api/annotations.proto";
|
|
||||||
import "rpc.proto";
|
import "rpc.proto";
|
||||||
|
|
||||||
package lnrpc;
|
package lnrpc;
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc";
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Comments in this file will be directly parsed into the API
|
* Comments in this file will be directly parsed into the API
|
||||||
* Documentation as descriptions of the associated method, message, or field.
|
* Documentation as descriptions of the associated method, message, or field.
|
||||||
* These descriptions should go right above the definition of the object, and
|
* These descriptions should go right above the definition of the object, and
|
||||||
* can be in either block or /// comment format.
|
* can be in either block or // comment format.
|
||||||
*
|
|
||||||
* One edge case exists where a // comment followed by a /// comment in the
|
|
||||||
* next line will cause the description not to show up in the documentation. In
|
|
||||||
* that instance, simply separate the two comments with a blank line.
|
|
||||||
*
|
*
|
||||||
* An RPC method can be matched to an lncli command by placing a line in the
|
* An RPC method can be matched to an lncli command by placing a line in the
|
||||||
* beginning of the description in exactly the following format:
|
* beginning of the description in exactly the following format:
|
||||||
|
|
@ -32,73 +27,56 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc";
|
||||||
// WalletUnlocker is a service that is used to set up a wallet password for
|
// WalletUnlocker is a service that is used to set up a wallet password for
|
||||||
// lnd at first startup, and unlock a previously set up wallet.
|
// lnd at first startup, and unlock a previously set up wallet.
|
||||||
service WalletUnlocker {
|
service WalletUnlocker {
|
||||||
/**
|
/*
|
||||||
GenSeed is the first method that should be used to instantiate a new lnd
|
GenSeed is the first method that should be used to instantiate a new lnd
|
||||||
instance. This method allows a caller to generate a new aezeed cipher seed
|
instance. This method allows a caller to generate a new aezeed cipher seed
|
||||||
given an optional passphrase. If provided, the passphrase will be necessary
|
given an optional passphrase. If provided, the passphrase will be necessary
|
||||||
to decrypt the cipherseed to expose the internal wallet seed.
|
to decrypt the cipherseed to expose the internal wallet seed.
|
||||||
|
|
||||||
Once the cipherseed is obtained and verified by the user, the InitWallet
|
Once the cipherseed is obtained and verified by the user, the InitWallet
|
||||||
method should be used to commit the newly generated seed, and create the
|
method should be used to commit the newly generated seed, and create the
|
||||||
wallet.
|
wallet.
|
||||||
*/
|
*/
|
||||||
rpc GenSeed (GenSeedRequest) returns (GenSeedResponse) {
|
rpc GenSeed (GenSeedRequest) returns (GenSeedResponse);
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/v1/genseed"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
InitWallet is used when lnd is starting up for the first time to fully
|
InitWallet is used when lnd is starting up for the first time to fully
|
||||||
initialize the daemon and its internal wallet. At the very least a wallet
|
initialize the daemon and its internal wallet. At the very least a wallet
|
||||||
password must be provided. This will be used to encrypt sensitive material
|
password must be provided. This will be used to encrypt sensitive material
|
||||||
on disk.
|
on disk.
|
||||||
|
|
||||||
In the case of a recovery scenario, the user can also specify their aezeed
|
In the case of a recovery scenario, the user can also specify their aezeed
|
||||||
mnemonic and passphrase. If set, then the daemon will use this prior state
|
mnemonic and passphrase. If set, then the daemon will use this prior state
|
||||||
to initialize its internal wallet.
|
to initialize its internal wallet.
|
||||||
|
|
||||||
Alternatively, this can be used along with the GenSeed RPC to obtain a
|
Alternatively, this can be used along with the GenSeed RPC to obtain a
|
||||||
seed, then present it to the user. Once it has been verified by the user,
|
seed, then present it to the user. Once it has been verified by the user,
|
||||||
the seed can be fed into this RPC in order to commit the new wallet.
|
the seed can be fed into this RPC in order to commit the new wallet.
|
||||||
*/
|
*/
|
||||||
rpc InitWallet (InitWalletRequest) returns (InitWalletResponse) {
|
rpc InitWallet (InitWalletRequest) returns (InitWalletResponse);
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/initwallet"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** lncli: `unlock`
|
/* lncli: `unlock`
|
||||||
UnlockWallet is used at startup of lnd to provide a password to unlock
|
UnlockWallet is used at startup of lnd to provide a password to unlock
|
||||||
the wallet database.
|
the wallet database.
|
||||||
*/
|
*/
|
||||||
rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletResponse) {
|
rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletResponse);
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/unlockwallet"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** lncli: `changepassword`
|
/* lncli: `changepassword`
|
||||||
ChangePassword changes the password of the encrypted wallet. This will
|
ChangePassword changes the password of the encrypted wallet. This will
|
||||||
automatically unlock the wallet database if successful.
|
automatically unlock the wallet database if successful.
|
||||||
*/
|
*/
|
||||||
rpc ChangePassword (ChangePasswordRequest)
|
rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse);
|
||||||
returns (ChangePasswordResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/changepassword"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GenSeedRequest {
|
message GenSeedRequest {
|
||||||
/**
|
/*
|
||||||
aezeed_passphrase is an optional user provided passphrase that will be used
|
aezeed_passphrase is an optional user provided passphrase that will be used
|
||||||
to encrypt the generated aezeed cipher seed. When using REST, this field
|
to encrypt the generated aezeed cipher seed. When using REST, this field
|
||||||
must be encoded as base64.
|
must be encoded as base64.
|
||||||
*/
|
*/
|
||||||
bytes aezeed_passphrase = 1;
|
bytes aezeed_passphrase = 1;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
seed_entropy is an optional 16-bytes generated via CSPRNG. If not
|
seed_entropy is an optional 16-bytes generated via CSPRNG. If not
|
||||||
specified, then a fresh set of randomness will be used to create the seed.
|
specified, then a fresh set of randomness will be used to create the seed.
|
||||||
When using REST, this field must be encoded as base64.
|
When using REST, this field must be encoded as base64.
|
||||||
|
|
@ -106,7 +84,7 @@ message GenSeedRequest {
|
||||||
bytes seed_entropy = 2;
|
bytes seed_entropy = 2;
|
||||||
}
|
}
|
||||||
message GenSeedResponse {
|
message GenSeedResponse {
|
||||||
/**
|
/*
|
||||||
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
|
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
|
||||||
cipher seed obtained by the user. This field is optional, as if not
|
cipher seed obtained by the user. This field is optional, as if not
|
||||||
provided, then the daemon will generate a new cipher seed for the user.
|
provided, then the daemon will generate a new cipher seed for the user.
|
||||||
|
|
@ -115,7 +93,7 @@ message GenSeedResponse {
|
||||||
*/
|
*/
|
||||||
repeated string cipher_seed_mnemonic = 1;
|
repeated string cipher_seed_mnemonic = 1;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
|
enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
|
||||||
cipher text before run through our mnemonic encoding scheme.
|
cipher text before run through our mnemonic encoding scheme.
|
||||||
*/
|
*/
|
||||||
|
|
@ -123,7 +101,7 @@ message GenSeedResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
message InitWalletRequest {
|
message InitWalletRequest {
|
||||||
/**
|
/*
|
||||||
wallet_password is the passphrase that should be used to encrypt the
|
wallet_password is the passphrase that should be used to encrypt the
|
||||||
wallet. This MUST be at least 8 chars in length. After creation, this
|
wallet. This MUST be at least 8 chars in length. After creation, this
|
||||||
password is required to unlock the daemon. When using REST, this field
|
password is required to unlock the daemon. When using REST, this field
|
||||||
|
|
@ -131,21 +109,21 @@ message InitWalletRequest {
|
||||||
*/
|
*/
|
||||||
bytes wallet_password = 1;
|
bytes wallet_password = 1;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
|
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
|
||||||
cipher seed obtained by the user. This may have been generated by the
|
cipher seed obtained by the user. This may have been generated by the
|
||||||
GenSeed method, or be an existing seed.
|
GenSeed method, or be an existing seed.
|
||||||
*/
|
*/
|
||||||
repeated string cipher_seed_mnemonic = 2;
|
repeated string cipher_seed_mnemonic = 2;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
aezeed_passphrase is an optional user provided passphrase that will be used
|
aezeed_passphrase is an optional user provided passphrase that will be used
|
||||||
to encrypt the generated aezeed cipher seed. When using REST, this field
|
to encrypt the generated aezeed cipher seed. When using REST, this field
|
||||||
must be encoded as base64.
|
must be encoded as base64.
|
||||||
*/
|
*/
|
||||||
bytes aezeed_passphrase = 3;
|
bytes aezeed_passphrase = 3;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
recovery_window is an optional argument specifying the address lookahead
|
recovery_window is an optional argument specifying the address lookahead
|
||||||
when restoring a wallet seed. The recovery window applies to each
|
when restoring a wallet seed. The recovery window applies to each
|
||||||
individual branch of the BIP44 derivation paths. Supplying a recovery
|
individual branch of the BIP44 derivation paths. Supplying a recovery
|
||||||
|
|
@ -154,7 +132,7 @@ message InitWalletRequest {
|
||||||
*/
|
*/
|
||||||
int32 recovery_window = 4;
|
int32 recovery_window = 4;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
channel_backups is an optional argument that allows clients to recover the
|
channel_backups is an optional argument that allows clients to recover the
|
||||||
settled funds within a set of channels. This should be populated if the
|
settled funds within a set of channels. This should be populated if the
|
||||||
user was unable to close out all channels and sweep funds before partial or
|
user was unable to close out all channels and sweep funds before partial or
|
||||||
|
|
@ -168,14 +146,14 @@ message InitWalletResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
message UnlockWalletRequest {
|
message UnlockWalletRequest {
|
||||||
/**
|
/*
|
||||||
wallet_password should be the current valid passphrase for the daemon. This
|
wallet_password should be the current valid passphrase for the daemon. This
|
||||||
will be required to decrypt on-disk material that the daemon requires to
|
will be required to decrypt on-disk material that the daemon requires to
|
||||||
function properly. When using REST, this field must be encoded as base64.
|
function properly. When using REST, this field must be encoded as base64.
|
||||||
*/
|
*/
|
||||||
bytes wallet_password = 1;
|
bytes wallet_password = 1;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
recovery_window is an optional argument specifying the address lookahead
|
recovery_window is an optional argument specifying the address lookahead
|
||||||
when restoring a wallet seed. The recovery window applies to each
|
when restoring a wallet seed. The recovery window applies to each
|
||||||
individual branch of the BIP44 derivation paths. Supplying a recovery
|
individual branch of the BIP44 derivation paths. Supplying a recovery
|
||||||
|
|
@ -184,7 +162,7 @@ message UnlockWalletRequest {
|
||||||
*/
|
*/
|
||||||
int32 recovery_window = 2;
|
int32 recovery_window = 2;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
channel_backups is an optional argument that allows clients to recover the
|
channel_backups is an optional argument that allows clients to recover the
|
||||||
settled funds within a set of channels. This should be populated if the
|
settled funds within a set of channels. This should be populated if the
|
||||||
user was unable to close out all channels and sweep funds before partial or
|
user was unable to close out all channels and sweep funds before partial or
|
||||||
|
|
@ -198,13 +176,13 @@ message UnlockWalletResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
message ChangePasswordRequest {
|
message ChangePasswordRequest {
|
||||||
/**
|
/*
|
||||||
current_password should be the current valid passphrase used to unlock the
|
current_password should be the current valid passphrase used to unlock the
|
||||||
daemon. When using REST, this field must be encoded as base64.
|
daemon. When using REST, this field must be encoded as base64.
|
||||||
*/
|
*/
|
||||||
bytes current_password = 1;
|
bytes current_password = 1;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
new_password should be the new passphrase that will be needed to unlock the
|
new_password should be the new passphrase that will be needed to unlock the
|
||||||
daemon. When using REST, this field must be encoded as base64.
|
daemon. When using REST, this field must be encoded as base64.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ module.exports = async ({
|
||||||
const [lnrpcProto, routerProto, walletUnlockerProto] = await Promise.all([protoLoader.load(lnrpcProtoPath, protoLoaderConfig), protoLoader.load(routerProtoPath, protoLoaderConfig), protoLoader.load(walletUnlockerProtoPath, protoLoaderConfig)]);
|
const [lnrpcProto, routerProto, walletUnlockerProto] = await Promise.all([protoLoader.load(lnrpcProtoPath, protoLoaderConfig), protoLoader.load(routerProtoPath, protoLoaderConfig), protoLoader.load(walletUnlockerProtoPath, protoLoaderConfig)]);
|
||||||
const { lnrpc } = grpc.loadPackageDefinition(lnrpcProto);
|
const { lnrpc } = grpc.loadPackageDefinition(lnrpcProto);
|
||||||
const { routerrpc } = grpc.loadPackageDefinition(routerProto);
|
const { routerrpc } = grpc.loadPackageDefinition(routerProto);
|
||||||
const { walletunlockerrpc } = grpc.loadPackageDefinition(walletUnlockerProto);
|
const { lnrpc: walletunlockerrpc } = grpc.loadPackageDefinition(walletUnlockerProto);
|
||||||
|
|
||||||
const getCredentials = async () => {
|
const getCredentials = async () => {
|
||||||
const lndCert = await fs.readFile(lndCertPath);
|
const lndCert = await fs.readFile(lndCertPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue