prysm-pulse/proto/validator/accounts/v2/web_api.proto
Raul Jordan 551b03d6e6
Resolve Web UI Beta Testing Bugs (#7471)
* more descriptive password validation error

* include change wallet password fixes

* balance and jwt improvements

* allow for different wallet dirs specified on startup

* ensure wallet password is always validated

* fix up prysm tests

* gaz

* test pass

* pass balances tests

* wrap up fixes

* radek feedback

* fix up tests

* cors fix

* add tests for validator status

* pass tests

* fix n

* skip content type test

* package level cache and send over feed

* package level cache for derived

* all tests passing

* gofmt

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-10 02:07:28 +00:00

300 lines
8.2 KiB
Protocol Buffer

syntax = "proto3";
package ethereum.validator.accounts.v2;
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Wallet {
rpc HasWallet(google.protobuf.Empty) returns (HasWalletResponse) {
option (google.api.http) = {
get: "/v2/validator/wallet/exists"
};
}
rpc CreateWallet(CreateWalletRequest) returns (CreateWalletResponse) {
option (google.api.http) = {
post: "/v2/validator/wallet/create",
body: "*"
};
}
rpc DefaultWalletPath(google.protobuf.Empty) returns (DefaultWalletResponse) {
option (google.api.http) = {
get: "/v2/validator/wallet/default",
};
}
rpc EditConfig(EditWalletConfigRequest) returns (WalletResponse) {
option (google.api.http) = {
post: "/v2/validator/wallet/config/edit",
body: "*"
};
}
rpc WalletConfig(google.protobuf.Empty) returns (WalletResponse) {
option (google.api.http) = {
get: "/v2/validator/wallet"
};
}
rpc GenerateMnemonic(google.protobuf.Empty) returns (GenerateMnemonicResponse) {
option (google.api.http) = {
get: "/v2/validator/mnemonic/generate"
};
}
rpc ChangePassword(ChangePasswordRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v2/validator/wallet/password/edit",
body: "*"
};
}
rpc ImportKeystores(ImportKeystoresRequest) returns (ImportKeystoresResponse) {
option (google.api.http) = {
post: "/v2/validator/wallet/keystores/import",
body: "*"
};
}
}
service Accounts {
rpc CreateAccount(CreateAccountRequest) returns (DepositDataResponse) {
option (google.api.http) = {
post: "/v2/validator/wallet/accounts/create",
body: "*"
};
}
rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) {
option (google.api.http) = {
get: "/v2/validator/accounts"
};
}
rpc BackupAccounts(BackupAccountsRequest) returns (BackupAccountsResponse) {
option (google.api.http) = {
post: "/v2/validator/wallet/accounts/backup",
body: "*"
};
}
rpc DeleteAccounts(DeleteAccountsRequest) returns (DeleteAccountsResponse) {
option (google.api.http) = {
post: "/v2/validator/wallet/accounts/delete",
body: "*"
};
}
}
service Health {
rpc GetBeaconNodeConnection(google.protobuf.Empty) returns (NodeConnectionResponse) {
option (google.api.http) = {
get: "/v2/validator/health/node_connection"
};
}
}
service Auth {
rpc Login(AuthRequest) returns (AuthResponse) {
option (google.api.http) = {
post: "/v2/validator/login",
body: "*"
};
}
rpc Signup(AuthRequest) returns (AuthResponse) {
option (google.api.http) = {
post: "/v2/validator/signup",
body: "*"
};
}
}
// Type of key manager for the wallet, either direct, derived, or remote.
enum KeymanagerKind {
DERIVED = 0;
DIRECT = 1;
REMOTE = 2;
}
message CreateWalletRequest {
// Path on disk where the wallet will be stored.
string wallet_path = 1;
KeymanagerKind keymanager = 2;
// Password for the wallet.
string wallet_password = 3;
// Mnemonic in case the user is creating a derived wallet.
string mnemonic = 4;
// Number of accounts.
uint64 num_accounts = 5;
// Remote address such as host.example.com:4000 for a gRPC remote signer server.
string remote_addr = 6;
// Path to client.crt for secure TLS connections to a remote signer server.
string remote_crt_path = 7;
// Path to client.key for secure TLS connections to a remote signer server.
string remote_key_path = 8;
// Path to ca.crt for secure TLS connections to a remote signer server.
string remote_ca_crt_path = 9;
}
message CreateWalletResponse {
WalletResponse wallet = 1;
DepositDataResponse accounts_created = 2;
}
message DefaultWalletResponse {
string wallet_dir = 1;
}
message EditWalletConfigRequest {
string remote_addr = 1;
string remote_crt_path = 2;
string remote_key_path = 3;
string remote_ca_crt_path = 4;
}
message GenerateMnemonicResponse {
string mnemonic = 1;
}
message WalletResponse {
string wallet_path = 1;
KeymanagerKind keymanager_kind = 2;
// Key manager configs, this is meant to be some what generic.
// It'll later be encoded with json to represent in front end UI.
map<string, string> keymanager_config = 3;
}
message ListAccountsRequest {
// Whether or not to return the raw RLP deposit tx data.
bool get_deposit_tx_data = 1;
// The maximum number of accounts to return in the response.
// This field is optional.
int32 page_size = 2;
// A pagination token returned from a previous call to `ListAccounts`
// that indicates where this listing should continue from.
// This field is optional.
string page_token = 3;
// Whether to return all available accounts in a single response.
bool all = 4;
}
message ListAccountsResponse {
repeated Account accounts = 1;
// A pagination token returned from a previous call to `ListAccounts`
// that indicates from where listing should continue.
// This field is optional.
string next_page_token = 2;
// Total count matching the request.
int32 total_size = 3;
}
message Account {
// The validating public key.
bytes validating_public_key = 1;
// The human readable account name.
string account_name = 2;
// The deposit data transaction RLP bytes.
bytes deposit_tx_data = 3;
// The derivation path (if using HD wallet).
string derivation_path = 4;
}
message AccountRequest {
// A list of validator public keys.
repeated bytes public_keys = 1;
// A list of validator indices.
repeated uint64 indices = 2;
}
message AuthRequest {
string password = 1;
string wallet_dir = 2;
}
message AuthResponse {
string token = 1;
uint64 token_expiration = 2;
}
message NodeConnectionResponse {
// The host address of the beacon node the validator
// client is connected to.
string beacon_node_endpoint = 1;
// Whether the connection is active.
bool connected = 2;
// Whether the beacon node is currently synchronizing to chain head.
bool syncing = 3;
// The chain genesis time.
uint64 genesis_time = 4;
// Address of the validator deposit contract in the eth1 chain.
bytes deposit_contract_address = 5;
}
message ChangePasswordRequest {
string current_password = 1;
string password = 2;
string password_confirmation = 3;
}
message HasWalletResponse {
// Whether or not the user has a wallet on disk.
bool wallet_exists = 1;
}
message ImportKeystoresRequest {
// JSON-encoded keystore files to import during wallet creation.
repeated string keystores_imported = 1;
// Password to unlock imported keystore files.
string keystores_password = 2;
}
message ImportKeystoresResponse {
repeated bytes imported_public_keys = 1;
}
message CreateAccountRequest {
uint64 num_accounts = 1;
}
message DepositMessage {
bytes pubkey = 1 [(gogoproto.moretags) = "ssz-size:\"48\""];
bytes withdrawal_credentials = 2 [(gogoproto.moretags) = "ssz-size:\"32\""];
uint64 amount = 3;
}
message DepositDataResponse {
// The deposit data for each created account
// represented as a list in the same format as
// the deposit_data.json file from the eth2.0-deposit-cli.
repeated DepositData deposit_data_list = 1;
message DepositData {
map<string, string> data = 1;
}
}
message BackupAccountsRequest {
// List of public keys to backup.
repeated bytes public_keys = 1;
string backup_password = 2;
}
message BackupAccountsResponse {
// Zip file containing backed up keystores.
bytes zip_file = 1;
}
message DeleteAccountsRequest {
// List of public keys to delete.
repeated bytes public_keys = 1;
}
message DeleteAccountsResponse {
// List of public keys successfully deleted.
repeated bytes deleted_keys = 1;
}