diff --git a/proto/eth/service/key_management.pb.go b/proto/eth/service/key_management.pb.go index 0a0ba8c01c39..d00ce6c5bd4e 100755 --- a/proto/eth/service/key_management.pb.go +++ b/proto/eth/service/key_management.pb.go @@ -12,13 +12,13 @@ import ( "sync" _ "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/golang/protobuf/ptypes/empty" + empty "github.com/golang/protobuf/ptypes/empty" _ "google.golang.org/genproto/googleapis/api/annotations" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -129,6 +129,107 @@ func (DeletedKeystoreStatus_Status) EnumDescriptor() ([]byte, []int) { return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{6, 0} } +type ImportedRemoteKeysStatus_Status int32 + +const ( + ImportedRemoteKeysStatus_UNKNOWN ImportedRemoteKeysStatus_Status = 0 + ImportedRemoteKeysStatus_IMPORTED ImportedRemoteKeysStatus_Status = 1 + ImportedRemoteKeysStatus_DUPLICATE ImportedRemoteKeysStatus_Status = 2 + ImportedRemoteKeysStatus_ERROR ImportedRemoteKeysStatus_Status = 3 +) + +// Enum value maps for ImportedRemoteKeysStatus_Status. +var ( + ImportedRemoteKeysStatus_Status_name = map[int32]string{ + 0: "UNKNOWN", + 1: "IMPORTED", + 2: "DUPLICATE", + 3: "ERROR", + } + ImportedRemoteKeysStatus_Status_value = map[string]int32{ + "UNKNOWN": 0, + "IMPORTED": 1, + "DUPLICATE": 2, + "ERROR": 3, + } +) + +func (x ImportedRemoteKeysStatus_Status) Enum() *ImportedRemoteKeysStatus_Status { + p := new(ImportedRemoteKeysStatus_Status) + *p = x + return p +} + +func (x ImportedRemoteKeysStatus_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ImportedRemoteKeysStatus_Status) Descriptor() protoreflect.EnumDescriptor { + return file_proto_eth_service_key_management_proto_enumTypes[2].Descriptor() +} + +func (ImportedRemoteKeysStatus_Status) Type() protoreflect.EnumType { + return &file_proto_eth_service_key_management_proto_enumTypes[2] +} + +func (x ImportedRemoteKeysStatus_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ImportedRemoteKeysStatus_Status.Descriptor instead. +func (ImportedRemoteKeysStatus_Status) EnumDescriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{12, 0} +} + +type DeletedRemoteKeysStatus_Status int32 + +const ( + DeletedRemoteKeysStatus_NOT_FOUND DeletedRemoteKeysStatus_Status = 0 + DeletedRemoteKeysStatus_DELETED DeletedRemoteKeysStatus_Status = 1 + DeletedRemoteKeysStatus_ERROR DeletedRemoteKeysStatus_Status = 3 +) + +// Enum value maps for DeletedRemoteKeysStatus_Status. +var ( + DeletedRemoteKeysStatus_Status_name = map[int32]string{ + 0: "NOT_FOUND", + 1: "DELETED", + 3: "ERROR", + } + DeletedRemoteKeysStatus_Status_value = map[string]int32{ + "NOT_FOUND": 0, + "DELETED": 1, + "ERROR": 3, + } +) + +func (x DeletedRemoteKeysStatus_Status) Enum() *DeletedRemoteKeysStatus_Status { + p := new(DeletedRemoteKeysStatus_Status) + *p = x + return p +} + +func (x DeletedRemoteKeysStatus_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DeletedRemoteKeysStatus_Status) Descriptor() protoreflect.EnumDescriptor { + return file_proto_eth_service_key_management_proto_enumTypes[3].Descriptor() +} + +func (DeletedRemoteKeysStatus_Status) Type() protoreflect.EnumType { + return &file_proto_eth_service_key_management_proto_enumTypes[3] +} + +func (x DeletedRemoteKeysStatus_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DeletedRemoteKeysStatus_Status.Descriptor instead. +func (DeletedRemoteKeysStatus_Status) EnumDescriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{13, 0} +} + type ListKeystoresResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -345,20 +446,475 @@ type DeleteKeystoresResponse struct { func (x *DeleteKeystoresResponse) Reset() { *x = DeleteKeystoresResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[4] + mi := &file_proto_eth_service_key_management_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteKeystoresResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteKeystoresResponse) ProtoMessage() {} + +func (x *DeleteKeystoresResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteKeystoresResponse.ProtoReflect.Descriptor instead. +func (*DeleteKeystoresResponse) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteKeystoresResponse) GetData() []*DeletedKeystoreStatus { + if x != nil { + return x.Data + } + return nil +} + +func (x *DeleteKeystoresResponse) GetSlashingProtection() string { + if x != nil { + return x.SlashingProtection + } + return "" +} + +type ImportedKeystoreStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status ImportedKeystoreStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.ImportedKeystoreStatus_Status" json:"status,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *ImportedKeystoreStatus) Reset() { + *x = ImportedKeystoreStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportedKeystoreStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportedKeystoreStatus) ProtoMessage() {} + +func (x *ImportedKeystoreStatus) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportedKeystoreStatus.ProtoReflect.Descriptor instead. +func (*ImportedKeystoreStatus) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{5} +} + +func (x *ImportedKeystoreStatus) GetStatus() ImportedKeystoreStatus_Status { + if x != nil { + return x.Status + } + return ImportedKeystoreStatus_IMPORTED +} + +func (x *ImportedKeystoreStatus) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeletedKeystoreStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status DeletedKeystoreStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.DeletedKeystoreStatus_Status" json:"status,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *DeletedKeystoreStatus) Reset() { + *x = DeletedKeystoreStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletedKeystoreStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletedKeystoreStatus) ProtoMessage() {} + +func (x *DeletedKeystoreStatus) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletedKeystoreStatus.ProtoReflect.Descriptor instead. +func (*DeletedKeystoreStatus) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{6} +} + +func (x *DeletedKeystoreStatus) GetStatus() DeletedKeystoreStatus_Status { + if x != nil { + return x.Status + } + return DeletedKeystoreStatus_DELETED +} + +func (x *DeletedKeystoreStatus) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ListRemoteKeysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []*ListRemoteKeysResponse_Keystore `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` +} + +func (x *ListRemoteKeysResponse) Reset() { + *x = ListRemoteKeysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRemoteKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRemoteKeysResponse) ProtoMessage() {} + +func (x *ListRemoteKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRemoteKeysResponse.ProtoReflect.Descriptor instead. +func (*ListRemoteKeysResponse) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{7} +} + +func (x *ListRemoteKeysResponse) GetData() []*ListRemoteKeysResponse_Keystore { + if x != nil { + return x.Data + } + return nil +} + +type ImportRemoteKeysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RemoteKeys []*ImportRemoteKeysRequest_Keystore `protobuf:"bytes,1,rep,name=remote_keys,json=remoteKeys,proto3" json:"remote_keys,omitempty"` +} + +func (x *ImportRemoteKeysRequest) Reset() { + *x = ImportRemoteKeysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportRemoteKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportRemoteKeysRequest) ProtoMessage() {} + +func (x *ImportRemoteKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportRemoteKeysRequest.ProtoReflect.Descriptor instead. +func (*ImportRemoteKeysRequest) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{8} +} + +func (x *ImportRemoteKeysRequest) GetRemoteKeys() []*ImportRemoteKeysRequest_Keystore { + if x != nil { + return x.RemoteKeys + } + return nil +} + +type ImportRemoteKeysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []*ImportedRemoteKeysStatus `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` +} + +func (x *ImportRemoteKeysResponse) Reset() { + *x = ImportRemoteKeysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportRemoteKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportRemoteKeysResponse) ProtoMessage() {} + +func (x *ImportRemoteKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportRemoteKeysResponse.ProtoReflect.Descriptor instead. +func (*ImportRemoteKeysResponse) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{9} +} + +func (x *ImportRemoteKeysResponse) GetData() []*ImportedRemoteKeysStatus { + if x != nil { + return x.Data + } + return nil +} + +type DeleteRemoteKeysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkeys [][]byte `protobuf:"bytes,1,rep,name=pubkeys,proto3" json:"pubkeys,omitempty"` +} + +func (x *DeleteRemoteKeysRequest) Reset() { + *x = DeleteRemoteKeysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRemoteKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRemoteKeysRequest) ProtoMessage() {} + +func (x *DeleteRemoteKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRemoteKeysRequest.ProtoReflect.Descriptor instead. +func (*DeleteRemoteKeysRequest) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{10} +} + +func (x *DeleteRemoteKeysRequest) GetPubkeys() [][]byte { + if x != nil { + return x.Pubkeys + } + return nil +} + +type DeleteRemoteKeysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []*DeletedRemoteKeysStatus `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` +} + +func (x *DeleteRemoteKeysResponse) Reset() { + *x = DeleteRemoteKeysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRemoteKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRemoteKeysResponse) ProtoMessage() {} + +func (x *DeleteRemoteKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRemoteKeysResponse.ProtoReflect.Descriptor instead. +func (*DeleteRemoteKeysResponse) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{11} +} + +func (x *DeleteRemoteKeysResponse) GetData() []*DeletedRemoteKeysStatus { + if x != nil { + return x.Data + } + return nil +} + +type ImportedRemoteKeysStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status ImportedRemoteKeysStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.ImportedRemoteKeysStatus_Status" json:"status,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *ImportedRemoteKeysStatus) Reset() { + *x = ImportedRemoteKeysStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportedRemoteKeysStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportedRemoteKeysStatus) ProtoMessage() {} + +func (x *ImportedRemoteKeysStatus) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportedRemoteKeysStatus.ProtoReflect.Descriptor instead. +func (*ImportedRemoteKeysStatus) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{12} +} + +func (x *ImportedRemoteKeysStatus) GetStatus() ImportedRemoteKeysStatus_Status { + if x != nil { + return x.Status + } + return ImportedRemoteKeysStatus_UNKNOWN +} + +func (x *ImportedRemoteKeysStatus) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeletedRemoteKeysStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status DeletedRemoteKeysStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.DeletedRemoteKeysStatus_Status" json:"status,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *DeletedRemoteKeysStatus) Reset() { + *x = DeletedRemoteKeysStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_eth_service_key_management_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *DeleteKeystoresResponse) String() string { +func (x *DeletedRemoteKeysStatus) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DeleteKeystoresResponse) ProtoMessage() {} +func (*DeletedRemoteKeysStatus) ProtoMessage() {} -func (x *DeleteKeystoresResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[4] +func (x *DeletedRemoteKeysStatus) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -369,51 +925,51 @@ func (x *DeleteKeystoresResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteKeystoresResponse.ProtoReflect.Descriptor instead. -func (*DeleteKeystoresResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{4} +// Deprecated: Use DeletedRemoteKeysStatus.ProtoReflect.Descriptor instead. +func (*DeletedRemoteKeysStatus) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{13} } -func (x *DeleteKeystoresResponse) GetData() []*DeletedKeystoreStatus { +func (x *DeletedRemoteKeysStatus) GetStatus() DeletedRemoteKeysStatus_Status { if x != nil { - return x.Data + return x.Status } - return nil + return DeletedRemoteKeysStatus_NOT_FOUND } -func (x *DeleteKeystoresResponse) GetSlashingProtection() string { +func (x *DeletedRemoteKeysStatus) GetMessage() string { if x != nil { - return x.SlashingProtection + return x.Message } return "" } -type ImportedKeystoreStatus struct { +type ListKeystoresResponse_Keystore struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Status ImportedKeystoreStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.ImportedKeystoreStatus_Status" json:"status,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + ValidatingPubkey []byte `protobuf:"bytes,1,opt,name=validating_pubkey,json=validatingPubkey,proto3" json:"validating_pubkey,omitempty"` + DerivationPath string `protobuf:"bytes,2,opt,name=derivation_path,json=derivationPath,proto3" json:"derivation_path,omitempty"` } -func (x *ImportedKeystoreStatus) Reset() { - *x = ImportedKeystoreStatus{} +func (x *ListKeystoresResponse_Keystore) Reset() { + *x = ListKeystoresResponse_Keystore{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[5] + mi := &file_proto_eth_service_key_management_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ImportedKeystoreStatus) String() string { +func (x *ListKeystoresResponse_Keystore) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ImportedKeystoreStatus) ProtoMessage() {} +func (*ListKeystoresResponse_Keystore) ProtoMessage() {} -func (x *ImportedKeystoreStatus) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[5] +func (x *ListKeystoresResponse_Keystore) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -424,51 +980,52 @@ func (x *ImportedKeystoreStatus) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ImportedKeystoreStatus.ProtoReflect.Descriptor instead. -func (*ImportedKeystoreStatus) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{5} +// Deprecated: Use ListKeystoresResponse_Keystore.ProtoReflect.Descriptor instead. +func (*ListKeystoresResponse_Keystore) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{0, 0} } -func (x *ImportedKeystoreStatus) GetStatus() ImportedKeystoreStatus_Status { +func (x *ListKeystoresResponse_Keystore) GetValidatingPubkey() []byte { if x != nil { - return x.Status + return x.ValidatingPubkey } - return ImportedKeystoreStatus_IMPORTED + return nil } -func (x *ImportedKeystoreStatus) GetMessage() string { +func (x *ListKeystoresResponse_Keystore) GetDerivationPath() string { if x != nil { - return x.Message + return x.DerivationPath } return "" } -type DeletedKeystoreStatus struct { +type ListRemoteKeysResponse_Keystore struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Status DeletedKeystoreStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.DeletedKeystoreStatus_Status" json:"status,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Readonly bool `protobuf:"varint,3,opt,name=readonly,proto3" json:"readonly,omitempty"` } -func (x *DeletedKeystoreStatus) Reset() { - *x = DeletedKeystoreStatus{} +func (x *ListRemoteKeysResponse_Keystore) Reset() { + *x = ListRemoteKeysResponse_Keystore{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[6] + mi := &file_proto_eth_service_key_management_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *DeletedKeystoreStatus) String() string { +func (x *ListRemoteKeysResponse_Keystore) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DeletedKeystoreStatus) ProtoMessage() {} +func (*ListRemoteKeysResponse_Keystore) ProtoMessage() {} -func (x *DeletedKeystoreStatus) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[6] +func (x *ListRemoteKeysResponse_Keystore) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -479,51 +1036,58 @@ func (x *DeletedKeystoreStatus) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeletedKeystoreStatus.ProtoReflect.Descriptor instead. -func (*DeletedKeystoreStatus) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{6} +// Deprecated: Use ListRemoteKeysResponse_Keystore.ProtoReflect.Descriptor instead. +func (*ListRemoteKeysResponse_Keystore) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{7, 0} } -func (x *DeletedKeystoreStatus) GetStatus() DeletedKeystoreStatus_Status { +func (x *ListRemoteKeysResponse_Keystore) GetPubkey() []byte { if x != nil { - return x.Status + return x.Pubkey } - return DeletedKeystoreStatus_DELETED + return nil } -func (x *DeletedKeystoreStatus) GetMessage() string { +func (x *ListRemoteKeysResponse_Keystore) GetUrl() string { if x != nil { - return x.Message + return x.Url } return "" } -type ListKeystoresResponse_Keystore struct { +func (x *ListRemoteKeysResponse_Keystore) GetReadonly() bool { + if x != nil { + return x.Readonly + } + return false +} + +type ImportRemoteKeysRequest_Keystore struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ValidatingPubkey []byte `protobuf:"bytes,1,opt,name=validating_pubkey,json=validatingPubkey,proto3" json:"validating_pubkey,omitempty"` - DerivationPath string `protobuf:"bytes,2,opt,name=derivation_path,json=derivationPath,proto3" json:"derivation_path,omitempty"` + Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` } -func (x *ListKeystoresResponse_Keystore) Reset() { - *x = ListKeystoresResponse_Keystore{} +func (x *ImportRemoteKeysRequest_Keystore) Reset() { + *x = ImportRemoteKeysRequest_Keystore{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[7] + mi := &file_proto_eth_service_key_management_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ListKeystoresResponse_Keystore) String() string { +func (x *ImportRemoteKeysRequest_Keystore) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListKeystoresResponse_Keystore) ProtoMessage() {} +func (*ImportRemoteKeysRequest_Keystore) ProtoMessage() {} -func (x *ListKeystoresResponse_Keystore) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[7] +func (x *ImportRemoteKeysRequest_Keystore) ProtoReflect() protoreflect.Message { + mi := &file_proto_eth_service_key_management_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -534,21 +1098,21 @@ func (x *ListKeystoresResponse_Keystore) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListKeystoresResponse_Keystore.ProtoReflect.Descriptor instead. -func (*ListKeystoresResponse_Keystore) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{0, 0} +// Deprecated: Use ImportRemoteKeysRequest_Keystore.ProtoReflect.Descriptor instead. +func (*ImportRemoteKeysRequest_Keystore) Descriptor() ([]byte, []int) { + return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{8, 0} } -func (x *ListKeystoresResponse_Keystore) GetValidatingPubkey() []byte { +func (x *ImportRemoteKeysRequest_Keystore) GetPubkey() []byte { if x != nil { - return x.ValidatingPubkey + return x.Pubkey } return nil } -func (x *ListKeystoresResponse_Keystore) GetDerivationPath() string { +func (x *ImportRemoteKeysRequest_Keystore) GetUrl() string { if x != nil { - return x.DerivationPath + return x.Url } return "" } @@ -627,45 +1191,134 @@ var file_proto_eth_service_key_management_proto_rawDesc = []byte{ 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x4f, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, - 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x32, 0xb9, 0x03, - 0x0a, 0x0d, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x78, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, - 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, - 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x49, 0x6d, - 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2c, 0x2e, - 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, - 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3a, 0x01, - 0x2a, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, + 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0xb5, 0x01, + 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x1a, 0x50, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x61, + 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, + 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x22, 0xa8, 0x01, 0x0a, 0x17, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x57, 0x0a, 0x0b, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x0a, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0x34, 0x0a, 0x08, 0x4b, 0x65, + 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x22, 0x5e, 0x0a, 0x18, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x22, 0x33, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, + 0x75, 0x62, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x75, + 0x62, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x5d, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x41, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x52, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x22, 0xc2, 0x01, 0x0a, 0x18, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x4d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x35, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3d, 0x0a, 0x06, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, + 0x0d, 0x0a, 0x09, 0x44, 0x55, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x45, 0x10, 0x02, 0x12, 0x09, + 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0xb2, 0x01, 0x0a, 0x17, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, - 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x2a, 0x1a, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x42, 0x97, 0x01, 0x0a, 0x18, 0x6f, 0x72, - 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x19, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, - 0x79, 0x73, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0xaa, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x14, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x65, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2f, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, + 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x32, 0xee, + 0x06, 0x0a, 0x0d, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x78, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, + 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, + 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x49, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2c, + 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, + 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3a, + 0x01, 0x2a, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, + 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x2a, 0x1a, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, + 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x7b, 0x0a, 0x0e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, + 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x99, 0x01, 0x0a, 0x10, 0x49, 0x6d, 0x70, 0x6f, + 0x72, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x2d, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x65, 0x74, + 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, + 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x6b, 0x65, 0x79, 0x73, + 0x3a, 0x01, 0x2a, 0x12, 0x99, 0x01, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x2a, + 0x1b, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, + 0x31, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x6b, 0x65, 0x79, 0x73, 0x3a, 0x01, 0x2a, 0x42, + 0x97, 0x01, 0x0a, 0x18, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, + 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x19, 0x4b, 0x65, + 0x79, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, + 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x65, 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xaa, 0x02, 0x14, 0x45, 0x74, + 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xca, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, + 0x68, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -680,38 +1333,61 @@ func file_proto_eth_service_key_management_proto_rawDescGZIP() []byte { return file_proto_eth_service_key_management_proto_rawDescData } -var file_proto_eth_service_key_management_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_proto_eth_service_key_management_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_proto_eth_service_key_management_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_proto_eth_service_key_management_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_proto_eth_service_key_management_proto_goTypes = []interface{}{ - (ImportedKeystoreStatus_Status)(0), // 0: ethereum.eth.service.ImportedKeystoreStatus.Status - (DeletedKeystoreStatus_Status)(0), // 1: ethereum.eth.service.DeletedKeystoreStatus.Status - (*ListKeystoresResponse)(nil), // 2: ethereum.eth.service.ListKeystoresResponse - (*ImportKeystoresRequest)(nil), // 3: ethereum.eth.service.ImportKeystoresRequest - (*ImportKeystoresResponse)(nil), // 4: ethereum.eth.service.ImportKeystoresResponse - (*DeleteKeystoresRequest)(nil), // 5: ethereum.eth.service.DeleteKeystoresRequest - (*DeleteKeystoresResponse)(nil), // 6: ethereum.eth.service.DeleteKeystoresResponse - (*ImportedKeystoreStatus)(nil), // 7: ethereum.eth.service.ImportedKeystoreStatus - (*DeletedKeystoreStatus)(nil), // 8: ethereum.eth.service.DeletedKeystoreStatus - (*ListKeystoresResponse_Keystore)(nil), // 9: ethereum.eth.service.ListKeystoresResponse.Keystore - (*empty.Empty)(nil), // 10: google.protobuf.Empty + (ImportedKeystoreStatus_Status)(0), // 0: ethereum.eth.service.ImportedKeystoreStatus.Status + (DeletedKeystoreStatus_Status)(0), // 1: ethereum.eth.service.DeletedKeystoreStatus.Status + (ImportedRemoteKeysStatus_Status)(0), // 2: ethereum.eth.service.ImportedRemoteKeysStatus.Status + (DeletedRemoteKeysStatus_Status)(0), // 3: ethereum.eth.service.DeletedRemoteKeysStatus.Status + (*ListKeystoresResponse)(nil), // 4: ethereum.eth.service.ListKeystoresResponse + (*ImportKeystoresRequest)(nil), // 5: ethereum.eth.service.ImportKeystoresRequest + (*ImportKeystoresResponse)(nil), // 6: ethereum.eth.service.ImportKeystoresResponse + (*DeleteKeystoresRequest)(nil), // 7: ethereum.eth.service.DeleteKeystoresRequest + (*DeleteKeystoresResponse)(nil), // 8: ethereum.eth.service.DeleteKeystoresResponse + (*ImportedKeystoreStatus)(nil), // 9: ethereum.eth.service.ImportedKeystoreStatus + (*DeletedKeystoreStatus)(nil), // 10: ethereum.eth.service.DeletedKeystoreStatus + (*ListRemoteKeysResponse)(nil), // 11: ethereum.eth.service.ListRemoteKeysResponse + (*ImportRemoteKeysRequest)(nil), // 12: ethereum.eth.service.ImportRemoteKeysRequest + (*ImportRemoteKeysResponse)(nil), // 13: ethereum.eth.service.ImportRemoteKeysResponse + (*DeleteRemoteKeysRequest)(nil), // 14: ethereum.eth.service.DeleteRemoteKeysRequest + (*DeleteRemoteKeysResponse)(nil), // 15: ethereum.eth.service.DeleteRemoteKeysResponse + (*ImportedRemoteKeysStatus)(nil), // 16: ethereum.eth.service.ImportedRemoteKeysStatus + (*DeletedRemoteKeysStatus)(nil), // 17: ethereum.eth.service.DeletedRemoteKeysStatus + (*ListKeystoresResponse_Keystore)(nil), // 18: ethereum.eth.service.ListKeystoresResponse.Keystore + (*ListRemoteKeysResponse_Keystore)(nil), // 19: ethereum.eth.service.ListRemoteKeysResponse.Keystore + (*ImportRemoteKeysRequest_Keystore)(nil), // 20: ethereum.eth.service.ImportRemoteKeysRequest.Keystore + (*empty.Empty)(nil), // 21: google.protobuf.Empty } var file_proto_eth_service_key_management_proto_depIdxs = []int32{ - 9, // 0: ethereum.eth.service.ListKeystoresResponse.data:type_name -> ethereum.eth.service.ListKeystoresResponse.Keystore - 7, // 1: ethereum.eth.service.ImportKeystoresResponse.data:type_name -> ethereum.eth.service.ImportedKeystoreStatus - 8, // 2: ethereum.eth.service.DeleteKeystoresResponse.data:type_name -> ethereum.eth.service.DeletedKeystoreStatus + 18, // 0: ethereum.eth.service.ListKeystoresResponse.data:type_name -> ethereum.eth.service.ListKeystoresResponse.Keystore + 9, // 1: ethereum.eth.service.ImportKeystoresResponse.data:type_name -> ethereum.eth.service.ImportedKeystoreStatus + 10, // 2: ethereum.eth.service.DeleteKeystoresResponse.data:type_name -> ethereum.eth.service.DeletedKeystoreStatus 0, // 3: ethereum.eth.service.ImportedKeystoreStatus.status:type_name -> ethereum.eth.service.ImportedKeystoreStatus.Status 1, // 4: ethereum.eth.service.DeletedKeystoreStatus.status:type_name -> ethereum.eth.service.DeletedKeystoreStatus.Status - 10, // 5: ethereum.eth.service.KeyManagement.ListKeystores:input_type -> google.protobuf.Empty - 3, // 6: ethereum.eth.service.KeyManagement.ImportKeystores:input_type -> ethereum.eth.service.ImportKeystoresRequest - 5, // 7: ethereum.eth.service.KeyManagement.DeleteKeystores:input_type -> ethereum.eth.service.DeleteKeystoresRequest - 2, // 8: ethereum.eth.service.KeyManagement.ListKeystores:output_type -> ethereum.eth.service.ListKeystoresResponse - 4, // 9: ethereum.eth.service.KeyManagement.ImportKeystores:output_type -> ethereum.eth.service.ImportKeystoresResponse - 6, // 10: ethereum.eth.service.KeyManagement.DeleteKeystores:output_type -> ethereum.eth.service.DeleteKeystoresResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 19, // 5: ethereum.eth.service.ListRemoteKeysResponse.data:type_name -> ethereum.eth.service.ListRemoteKeysResponse.Keystore + 20, // 6: ethereum.eth.service.ImportRemoteKeysRequest.remote_keys:type_name -> ethereum.eth.service.ImportRemoteKeysRequest.Keystore + 16, // 7: ethereum.eth.service.ImportRemoteKeysResponse.data:type_name -> ethereum.eth.service.ImportedRemoteKeysStatus + 17, // 8: ethereum.eth.service.DeleteRemoteKeysResponse.data:type_name -> ethereum.eth.service.DeletedRemoteKeysStatus + 2, // 9: ethereum.eth.service.ImportedRemoteKeysStatus.status:type_name -> ethereum.eth.service.ImportedRemoteKeysStatus.Status + 3, // 10: ethereum.eth.service.DeletedRemoteKeysStatus.status:type_name -> ethereum.eth.service.DeletedRemoteKeysStatus.Status + 21, // 11: ethereum.eth.service.KeyManagement.ListKeystores:input_type -> google.protobuf.Empty + 5, // 12: ethereum.eth.service.KeyManagement.ImportKeystores:input_type -> ethereum.eth.service.ImportKeystoresRequest + 7, // 13: ethereum.eth.service.KeyManagement.DeleteKeystores:input_type -> ethereum.eth.service.DeleteKeystoresRequest + 21, // 14: ethereum.eth.service.KeyManagement.ListRemoteKeys:input_type -> google.protobuf.Empty + 12, // 15: ethereum.eth.service.KeyManagement.ImportRemoteKeys:input_type -> ethereum.eth.service.ImportRemoteKeysRequest + 14, // 16: ethereum.eth.service.KeyManagement.DeleteRemoteKeys:input_type -> ethereum.eth.service.DeleteRemoteKeysRequest + 4, // 17: ethereum.eth.service.KeyManagement.ListKeystores:output_type -> ethereum.eth.service.ListKeystoresResponse + 6, // 18: ethereum.eth.service.KeyManagement.ImportKeystores:output_type -> ethereum.eth.service.ImportKeystoresResponse + 8, // 19: ethereum.eth.service.KeyManagement.DeleteKeystores:output_type -> ethereum.eth.service.DeleteKeystoresResponse + 11, // 20: ethereum.eth.service.KeyManagement.ListRemoteKeys:output_type -> ethereum.eth.service.ListRemoteKeysResponse + 13, // 21: ethereum.eth.service.KeyManagement.ImportRemoteKeys:output_type -> ethereum.eth.service.ImportRemoteKeysResponse + 15, // 22: ethereum.eth.service.KeyManagement.DeleteRemoteKeys:output_type -> ethereum.eth.service.DeleteRemoteKeysResponse + 17, // [17:23] is the sub-list for method output_type + 11, // [11:17] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_proto_eth_service_key_management_proto_init() } @@ -805,6 +1481,90 @@ func file_proto_eth_service_key_management_proto_init() { } } file_proto_eth_service_key_management_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRemoteKeysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportRemoteKeysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportRemoteKeysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRemoteKeysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRemoteKeysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportedRemoteKeysStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletedRemoteKeysStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListKeystoresResponse_Keystore); i { case 0: return &v.state @@ -816,14 +1576,38 @@ func file_proto_eth_service_key_management_proto_init() { return nil } } + file_proto_eth_service_key_management_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRemoteKeysResponse_Keystore); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_eth_service_key_management_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportRemoteKeysRequest_Keystore); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_eth_service_key_management_proto_rawDesc, - NumEnums: 2, - NumMessages: 8, + NumEnums: 4, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, @@ -853,6 +1637,9 @@ type KeyManagementClient interface { ListKeystores(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ListKeystoresResponse, error) ImportKeystores(ctx context.Context, in *ImportKeystoresRequest, opts ...grpc.CallOption) (*ImportKeystoresResponse, error) DeleteKeystores(ctx context.Context, in *DeleteKeystoresRequest, opts ...grpc.CallOption) (*DeleteKeystoresResponse, error) + ListRemoteKeys(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ListRemoteKeysResponse, error) + ImportRemoteKeys(ctx context.Context, in *ImportRemoteKeysRequest, opts ...grpc.CallOption) (*ImportRemoteKeysResponse, error) + DeleteRemoteKeys(ctx context.Context, in *DeleteRemoteKeysRequest, opts ...grpc.CallOption) (*DeleteRemoteKeysResponse, error) } type keyManagementClient struct { @@ -890,11 +1677,41 @@ func (c *keyManagementClient) DeleteKeystores(ctx context.Context, in *DeleteKey return out, nil } +func (c *keyManagementClient) ListRemoteKeys(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ListRemoteKeysResponse, error) { + out := new(ListRemoteKeysResponse) + err := c.cc.Invoke(ctx, "/ethereum.eth.service.KeyManagement/ListRemoteKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keyManagementClient) ImportRemoteKeys(ctx context.Context, in *ImportRemoteKeysRequest, opts ...grpc.CallOption) (*ImportRemoteKeysResponse, error) { + out := new(ImportRemoteKeysResponse) + err := c.cc.Invoke(ctx, "/ethereum.eth.service.KeyManagement/ImportRemoteKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keyManagementClient) DeleteRemoteKeys(ctx context.Context, in *DeleteRemoteKeysRequest, opts ...grpc.CallOption) (*DeleteRemoteKeysResponse, error) { + out := new(DeleteRemoteKeysResponse) + err := c.cc.Invoke(ctx, "/ethereum.eth.service.KeyManagement/DeleteRemoteKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // KeyManagementServer is the server API for KeyManagement service. type KeyManagementServer interface { ListKeystores(context.Context, *empty.Empty) (*ListKeystoresResponse, error) ImportKeystores(context.Context, *ImportKeystoresRequest) (*ImportKeystoresResponse, error) DeleteKeystores(context.Context, *DeleteKeystoresRequest) (*DeleteKeystoresResponse, error) + ListRemoteKeys(context.Context, *empty.Empty) (*ListRemoteKeysResponse, error) + ImportRemoteKeys(context.Context, *ImportRemoteKeysRequest) (*ImportRemoteKeysResponse, error) + DeleteRemoteKeys(context.Context, *DeleteRemoteKeysRequest) (*DeleteRemoteKeysResponse, error) } // UnimplementedKeyManagementServer can be embedded to have forward compatible implementations. @@ -910,6 +1727,15 @@ func (*UnimplementedKeyManagementServer) ImportKeystores(context.Context, *Impor func (*UnimplementedKeyManagementServer) DeleteKeystores(context.Context, *DeleteKeystoresRequest) (*DeleteKeystoresResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteKeystores not implemented") } +func (*UnimplementedKeyManagementServer) ListRemoteKeys(context.Context, *empty.Empty) (*ListRemoteKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRemoteKeys not implemented") +} +func (*UnimplementedKeyManagementServer) ImportRemoteKeys(context.Context, *ImportRemoteKeysRequest) (*ImportRemoteKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportRemoteKeys not implemented") +} +func (*UnimplementedKeyManagementServer) DeleteRemoteKeys(context.Context, *DeleteRemoteKeysRequest) (*DeleteRemoteKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRemoteKeys not implemented") +} func RegisterKeyManagementServer(s *grpc.Server, srv KeyManagementServer) { s.RegisterService(&_KeyManagement_serviceDesc, srv) @@ -969,6 +1795,60 @@ func _KeyManagement_DeleteKeystores_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _KeyManagement_ListRemoteKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(empty.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyManagementServer).ListRemoteKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ethereum.eth.service.KeyManagement/ListRemoteKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyManagementServer).ListRemoteKeys(ctx, req.(*empty.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _KeyManagement_ImportRemoteKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportRemoteKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyManagementServer).ImportRemoteKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ethereum.eth.service.KeyManagement/ImportRemoteKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyManagementServer).ImportRemoteKeys(ctx, req.(*ImportRemoteKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KeyManagement_DeleteRemoteKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRemoteKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyManagementServer).DeleteRemoteKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ethereum.eth.service.KeyManagement/DeleteRemoteKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyManagementServer).DeleteRemoteKeys(ctx, req.(*DeleteRemoteKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _KeyManagement_serviceDesc = grpc.ServiceDesc{ ServiceName: "ethereum.eth.service.KeyManagement", HandlerType: (*KeyManagementServer)(nil), @@ -985,6 +1865,18 @@ var _KeyManagement_serviceDesc = grpc.ServiceDesc{ MethodName: "DeleteKeystores", Handler: _KeyManagement_DeleteKeystores_Handler, }, + { + MethodName: "ListRemoteKeys", + Handler: _KeyManagement_ListRemoteKeys_Handler, + }, + { + MethodName: "ImportRemoteKeys", + Handler: _KeyManagement_ImportRemoteKeys_Handler, + }, + { + MethodName: "DeleteRemoteKeys", + Handler: _KeyManagement_DeleteRemoteKeys_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/eth/service/key_management.proto", diff --git a/proto/eth/service/key_management.pb.gw.go b/proto/eth/service/key_management.pb.gw.go index 298f0e7935af..72e52a3e4e13 100755 --- a/proto/eth/service/key_management.pb.gw.go +++ b/proto/eth/service/key_management.pb.gw.go @@ -123,6 +123,92 @@ func local_request_KeyManagement_DeleteKeystores_0(ctx context.Context, marshale } +func request_KeyManagement_ListRemoteKeys_0(ctx context.Context, marshaler runtime.Marshaler, client KeyManagementClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := client.ListRemoteKeys(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_KeyManagement_ListRemoteKeys_0(ctx context.Context, marshaler runtime.Marshaler, server KeyManagementServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := server.ListRemoteKeys(ctx, &protoReq) + return msg, metadata, err + +} + +func request_KeyManagement_ImportRemoteKeys_0(ctx context.Context, marshaler runtime.Marshaler, client KeyManagementClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ImportRemoteKeysRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ImportRemoteKeys(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_KeyManagement_ImportRemoteKeys_0(ctx context.Context, marshaler runtime.Marshaler, server KeyManagementServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ImportRemoteKeysRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ImportRemoteKeys(ctx, &protoReq) + return msg, metadata, err + +} + +func request_KeyManagement_DeleteRemoteKeys_0(ctx context.Context, marshaler runtime.Marshaler, client KeyManagementClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteRemoteKeysRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DeleteRemoteKeys(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_KeyManagement_DeleteRemoteKeys_0(ctx context.Context, marshaler runtime.Marshaler, server KeyManagementServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteRemoteKeysRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DeleteRemoteKeys(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterKeyManagementHandlerServer registers the http handlers for service KeyManagement to "mux". // UnaryRPC :call KeyManagementServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -198,6 +284,75 @@ func RegisterKeyManagementHandlerServer(ctx context.Context, mux *runtime.ServeM }) + mux.Handle("GET", pattern_KeyManagement_ListRemoteKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.service.KeyManagement/ListRemoteKeys") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_KeyManagement_ListRemoteKeys_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_KeyManagement_ListRemoteKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_KeyManagement_ImportRemoteKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.service.KeyManagement/ImportRemoteKeys") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_KeyManagement_ImportRemoteKeys_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_KeyManagement_ImportRemoteKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_KeyManagement_DeleteRemoteKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.service.KeyManagement/DeleteRemoteKeys") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_KeyManagement_DeleteRemoteKeys_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_KeyManagement_DeleteRemoteKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -299,6 +454,66 @@ func RegisterKeyManagementHandlerClient(ctx context.Context, mux *runtime.ServeM }) + mux.Handle("GET", pattern_KeyManagement_ListRemoteKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.service.KeyManagement/ListRemoteKeys") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_KeyManagement_ListRemoteKeys_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_KeyManagement_ListRemoteKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_KeyManagement_ImportRemoteKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.service.KeyManagement/ImportRemoteKeys") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_KeyManagement_ImportRemoteKeys_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_KeyManagement_ImportRemoteKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_KeyManagement_DeleteRemoteKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.service.KeyManagement/DeleteRemoteKeys") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_KeyManagement_DeleteRemoteKeys_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_KeyManagement_DeleteRemoteKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -308,6 +523,12 @@ var ( pattern_KeyManagement_ImportKeystores_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "keystores"}, "")) pattern_KeyManagement_DeleteKeystores_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "keystores"}, "")) + + pattern_KeyManagement_ListRemoteKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "remotekeys"}, "")) + + pattern_KeyManagement_ImportRemoteKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "remotekeys"}, "")) + + pattern_KeyManagement_DeleteRemoteKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "remotekeys"}, "")) ) var ( @@ -316,4 +537,10 @@ var ( forward_KeyManagement_ImportKeystores_0 = runtime.ForwardResponseMessage forward_KeyManagement_DeleteKeystores_0 = runtime.ForwardResponseMessage + + forward_KeyManagement_ListRemoteKeys_0 = runtime.ForwardResponseMessage + + forward_KeyManagement_ImportRemoteKeys_0 = runtime.ForwardResponseMessage + + forward_KeyManagement_DeleteRemoteKeys_0 = runtime.ForwardResponseMessage ) diff --git a/proto/eth/service/key_management.proto b/proto/eth/service/key_management.proto index 270f4f837fc2..091261ce0bbc 100644 --- a/proto/eth/service/key_management.proto +++ b/proto/eth/service/key_management.proto @@ -84,6 +84,27 @@ service KeyManagement { body: "*" }; } + + + rpc ListRemoteKeys(google.protobuf.Empty) returns (ListRemoteKeysResponse) { + option (google.api.http) = { + get: "/internal/eth/v1/remotekeys" + }; + } + + rpc ImportRemoteKeys(ImportRemoteKeysRequest) returns (ImportRemoteKeysResponse) { + option (google.api.http) = { + post: "/internal/eth/v1/remotekeys", + body: "*" + }; + } + + rpc DeleteRemoteKeys(DeleteRemoteKeysRequest) returns (DeleteRemoteKeysResponse) { + option (google.api.http) = { + delete: "/internal/eth/v1/remotekeys", + body: "*" + }; + } } message ListKeystoresResponse { @@ -133,3 +154,55 @@ message DeletedKeystoreStatus { Status status = 1; string message = 2; } + + +message ListRemoteKeysResponse { + message Keystore { + bytes pubkey = 1; + string url = 2; + bool readonly = 3; + } + repeated Keystore data = 1; +} + +message ImportRemoteKeysRequest { + message Keystore { + bytes pubkey = 1; + string url = 2; + } + repeated Keystore remote_keys = 1; +} + +message ImportRemoteKeysResponse { + repeated ImportedRemoteKeysStatus data = 1; +} + +message DeleteRemoteKeysRequest { + repeated bytes pubkeys = 1; +} + +message DeleteRemoteKeysResponse { + repeated DeletedRemoteKeysStatus data = 1; +} + +message ImportedRemoteKeysStatus { + enum Status { + UNKNOWN = 0; + IMPORTED = 1; + DUPLICATE = 2; + ERROR = 3; + } + Status status = 1; + string message = 2; +} + +message DeletedRemoteKeysStatus { + enum Status { + NOT_FOUND = 0; + DELETED = 1; + ERROR = 3; // skips 2 to match Delete KeyStore status which has error = 3. + } + Status status = 1; + string message = 2; +} + diff --git a/validator/client/service.go b/validator/client/service.go index 8533a468b1ee..716fd4295407 100644 --- a/validator/client/service.go +++ b/validator/client/service.go @@ -69,7 +69,7 @@ type ValidatorService struct { db db.Database grpcHeaders []string graffiti []byte - web3SignerConfig *remote_web3signer.SetupConfig + Web3SignerConfig *remote_web3signer.SetupConfig feeRecipientConfig *validator_service_config.FeeRecipientConfig } @@ -122,7 +122,7 @@ func NewValidatorService(ctx context.Context, cfg *Config) (*ValidatorService, e interopKeysConfig: cfg.InteropKeysConfig, graffitiStruct: cfg.GraffitiStruct, logDutyCountDown: cfg.LogDutyCountDown, - web3SignerConfig: cfg.Web3SignerConfig, + Web3SignerConfig: cfg.Web3SignerConfig, feeRecipientConfig: cfg.FeeRecipientConfig, }, nil } @@ -204,7 +204,7 @@ func (v *ValidatorService) Start() { graffitiOrderedIndex: graffitiOrderedIndex, eipImportBlacklistedPublicKeys: slashablePublicKeys, logDutyCountDown: v.logDutyCountDown, - Web3SignerConfig: v.web3SignerConfig, + Web3SignerConfig: v.Web3SignerConfig, feeRecipientConfig: v.feeRecipientConfig, walletIntializedChannel: make(chan *wallet.Wallet, 1), } diff --git a/validator/client/validator.go b/validator/client/validator.go index b15a0a9f66f0..501a2844ed10 100644 --- a/validator/client/validator.go +++ b/validator/client/validator.go @@ -117,6 +117,7 @@ func (v *validator) WaitForKeymanagerInitialization(ctx context.Context) error { } if v.useWeb && v.wallet == nil { + log.Info("Waiting for keymanager to initialize validator client with web UI") // if wallet is not set, wait for it to be set through the UI km, err := waitForWebWalletInitialization(ctx, v.walletInitializedFeed, v.walletIntializedChannel) if err != nil { diff --git a/validator/keymanager/BUILD.bazel b/validator/keymanager/BUILD.bazel index 6abbe22937a8..fa0c695b3929 100644 --- a/validator/keymanager/BUILD.bazel +++ b/validator/keymanager/BUILD.bazel @@ -32,5 +32,6 @@ go_test( "//validator/keymanager/derived:go_default_library", "//validator/keymanager/local:go_default_library", "//validator/keymanager/remote:go_default_library", + "//validator/keymanager/remote-web3signer:go_default_library", ], ) diff --git a/validator/keymanager/remote-web3signer/BUILD.bazel b/validator/keymanager/remote-web3signer/BUILD.bazel index 0ff8c48c8881..c83c91e37100 100644 --- a/validator/keymanager/remote-web3signer/BUILD.bazel +++ b/validator/keymanager/remote-web3signer/BUILD.bazel @@ -28,6 +28,7 @@ go_library( "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", "@com_github_prometheus_client_golang//prometheus/promauto:go_default_library", + "@com_github_sirupsen_logrus//:go_default_library", ], ) @@ -36,8 +37,10 @@ go_test( srcs = ["keymanager_test.go"], embed = [":go_default_library"], deps = [ + "//config/fieldparams:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/eth/service:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "//testing/require:go_default_library", "//validator/keymanager/remote-web3signer/internal:go_default_library", diff --git a/validator/keymanager/remote-web3signer/keymanager.go b/validator/keymanager/remote-web3signer/keymanager.go index 6cf370e4a362..c989d74b8a09 100644 --- a/validator/keymanager/remote-web3signer/keymanager.go +++ b/validator/keymanager/remote-web3signer/keymanager.go @@ -1,6 +1,7 @@ package remote_web3signer import ( + "bytes" "context" "encoding/json" "fmt" @@ -20,6 +21,7 @@ import ( remote_utils "github.com/prysmaticlabs/prysm/validator/keymanager/remote-utils" "github.com/prysmaticlabs/prysm/validator/keymanager/remote-web3signer/internal" v1 "github.com/prysmaticlabs/prysm/validator/keymanager/remote-web3signer/v1" + log "github.com/sirupsen/logrus" ) // SetupConfig includes configuration values for initializing. @@ -48,6 +50,7 @@ type Keymanager struct { providedPublicKeys [][48]byte accountsChangedFeed *event.Feed validator *validator.Validate + publicKeysUrlCalled bool } // NewKeymanager instantiates a new web3signer key manager. @@ -55,12 +58,6 @@ func NewKeymanager(_ context.Context, cfg *SetupConfig) (*Keymanager, error) { if cfg.BaseEndpoint == "" || !bytesutil.IsValidRoot(cfg.GenesisValidatorsRoot) { return nil, fmt.Errorf("invalid setup config, one or more configs are empty: BaseEndpoint: %v, GenesisValidatorsRoot: %#x", cfg.BaseEndpoint, cfg.GenesisValidatorsRoot) } - if cfg.PublicKeysURL != "" && len(cfg.ProvidedPublicKeys) != 0 { - return nil, errors.New("Either a provided list of public keys or a URL to a list of public keys must be provided, but not both") - } - if cfg.PublicKeysURL == "" && len(cfg.ProvidedPublicKeys) == 0 { - return nil, errors.New("no valid public key options provided") - } client, err := internal.NewApiClient(cfg.BaseEndpoint) if err != nil { return nil, errors.Wrap(err, "could not create apiClient") @@ -72,6 +69,7 @@ func NewKeymanager(_ context.Context, cfg *SetupConfig) (*Keymanager, error) { publicKeysURL: cfg.PublicKeysURL, providedPublicKeys: cfg.ProvidedPublicKeys, validator: validator.New(), + publicKeysUrlCalled: false, }, nil } @@ -79,12 +77,14 @@ func NewKeymanager(_ context.Context, cfg *SetupConfig) (*Keymanager, error) { // from the remote server or from the provided keys if there are no existing public keys set // or provides the existing keys in the keymanager. func (km *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][fieldparams.BLSPubkeyLength]byte, error) { - if km.publicKeysURL != "" && len(km.providedPublicKeys) == 0 { + if km.publicKeysURL != "" && !km.publicKeysUrlCalled { providedPublicKeys, err := km.client.GetPublicKeys(ctx, km.publicKeysURL) if err != nil { erroredResponsesTotal.Inc() return nil, errors.Wrap(err, fmt.Sprintf("could not get public keys from remote server url: %v", km.publicKeysURL)) } + // makes sure that if the public keys are deleted the validator does not call URL again. + km.publicKeysUrlCalled = true km.providedPublicKeys = providedPublicKeys } return km.providedPublicKeys, nil @@ -231,13 +231,8 @@ func getSignRequestJson(ctx context.Context, validator *validator.Validate, requ } // SubscribeAccountChanges returns the event subscription for changes to public keys. -func (*Keymanager) SubscribeAccountChanges(_ chan [][48]byte) event.Subscription { - // Not used right now. - // Returns a stub for the time being as there is a danger of being slashed if the apiClient reloads keys dynamically. - // Because there is no way to dynamically reload keys, add or remove remote keys we are returning a stub without any event updates for the time being. - return event.NewSubscription(func(i <-chan struct{}) error { - return nil - }) +func (km *Keymanager) SubscribeAccountChanges(pubKeysChan chan [][fieldparams.BLSPubkeyLength]byte) event.Subscription { + return km.accountsChangedFeed.Subscribe(pubKeysChan) } // ExtractKeystores is not supported for the remote-web3signer keymanager type. @@ -278,3 +273,73 @@ func (km *Keymanager) ListKeymanagerAccounts(ctx context.Context, cfg keymanager remote_utils.DisplayRemotePublicKeys(validatingPubKeys) return nil } + +// AddPublicKeys imports a list of public keys into the keymanager for web3signer use. Returns status with message. +func (km *Keymanager) AddPublicKeys(ctx context.Context, pubKeys [][fieldparams.BLSPubkeyLength]byte) ([]*ethpbservice.ImportedRemoteKeysStatus, error) { + if ctx == nil { + return nil, errors.New("context is nil") + } + importedRemoteKeysStatuses := make([]*ethpbservice.ImportedRemoteKeysStatus, len(pubKeys)) + for i, pubKey := range pubKeys { + found := false + for _, key := range km.providedPublicKeys { + if bytes.Equal(key[:], pubKey[:]) { + found = true + break + } + } + if found { + importedRemoteKeysStatuses[i] = ðpbservice.ImportedRemoteKeysStatus{ + Status: ethpbservice.ImportedRemoteKeysStatus_DUPLICATE, + Message: fmt.Sprintf("Duplicate pubkey: %v, already in use", hexutil.Encode(pubKey[:])), + } + continue + } + km.providedPublicKeys = append(km.providedPublicKeys, pubKey) + importedRemoteKeysStatuses[i] = ðpbservice.ImportedRemoteKeysStatus{ + Status: ethpbservice.ImportedRemoteKeysStatus_IMPORTED, + Message: fmt.Sprintf("Successfully added pubkey: %v", hexutil.Encode(pubKey[:])), + } + log.Debug("Added pubkey to keymanager for web3signer", "pubkey", hexutil.Encode(pubKey[:])) + } + km.accountsChangedFeed.Send(km.providedPublicKeys) + return importedRemoteKeysStatuses, nil +} + +// DeletePublicKeys removes a list of public keys from the keymanager for web3signer use. Returns status with message. +func (km *Keymanager) DeletePublicKeys(ctx context.Context, pubKeys [][fieldparams.BLSPubkeyLength]byte) ([]*ethpbservice.DeletedRemoteKeysStatus, error) { + if ctx == nil { + return nil, errors.New("context is nil") + } + deletedRemoteKeysStatuses := make([]*ethpbservice.DeletedRemoteKeysStatus, len(pubKeys)) + if len(km.providedPublicKeys) == 0 { + for i := range deletedRemoteKeysStatuses { + deletedRemoteKeysStatuses[i] = ðpbservice.DeletedRemoteKeysStatus{ + Status: ethpbservice.DeletedRemoteKeysStatus_NOT_FOUND, + Message: "No pubkeys are set in validator", + } + } + return deletedRemoteKeysStatuses, nil + } + for i, pubkey := range pubKeys { + for in, key := range km.providedPublicKeys { + if bytes.Equal(key[:], pubkey[:]) { + km.providedPublicKeys = append(km.providedPublicKeys[:in], km.providedPublicKeys[in+1:]...) + deletedRemoteKeysStatuses[i] = ðpbservice.DeletedRemoteKeysStatus{ + Status: ethpbservice.DeletedRemoteKeysStatus_DELETED, + Message: fmt.Sprintf("Successfully deleted pubkey: %v", hexutil.Encode(pubkey[:])), + } + log.Debug("Deleted pubkey from keymanager for web3signer", "pubkey", hexutil.Encode(pubkey[:])) + break + } + } + if deletedRemoteKeysStatuses[i] == nil { + deletedRemoteKeysStatuses[i] = ðpbservice.DeletedRemoteKeysStatus{ + Status: ethpbservice.DeletedRemoteKeysStatus_NOT_FOUND, + Message: fmt.Sprintf("Pubkey: %v not found", hexutil.Encode(pubkey[:])), + } + } + } + km.accountsChangedFeed.Send(km.providedPublicKeys) + return deletedRemoteKeysStatuses, nil +} diff --git a/validator/keymanager/remote-web3signer/keymanager_test.go b/validator/keymanager/remote-web3signer/keymanager_test.go index 17790bb307ac..b5d25dee7fe8 100644 --- a/validator/keymanager/remote-web3signer/keymanager_test.go +++ b/validator/keymanager/remote-web3signer/keymanager_test.go @@ -8,8 +8,10 @@ import ( "testing" "github.com/ethereum/go-ethereum/common/hexutil" + fieldparams "github.com/prysmaticlabs/prysm/config/fieldparams" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" + ethpbservice "github.com/prysmaticlabs/prysm/proto/eth/service" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/keymanager/remote-web3signer/internal" @@ -266,3 +268,72 @@ func TestKeymanager_FetchValidatingPublicKeys_WithExternalURL_ThrowsError(t *tes assert.Nil(t, resp) assert.Equal(t, "could not get public keys from remote server url: http://example2.com/api/v1/eth2/publicKeys: mock error", fmt.Sprintf("%v", err)) } + +func TestKeymanager_AddPublicKeys(t *testing.T) { + ctx := context.Background() + root, err := hexutil.Decode("0x270d43e74ce340de4bca2b1936beca0f4f5408d9e78aec4850920baf659d5b69") + if err != nil { + fmt.Printf("error: %v", err) + } + config := &SetupConfig{ + BaseEndpoint: "http://example.com", + GenesisValidatorsRoot: root, + } + km, err := NewKeymanager(ctx, config) + if err != nil { + fmt.Printf("error: %v", err) + } + pubkey, err := hexutil.Decode("0xa2b5aaad9c6efefe7bb9b1243a043404f3362937cfb6b31833929833173f476630ea2cfeb0d9ddf15f97ca8685948820") + require.NoError(t, err) + publicKeys := [][fieldparams.BLSPubkeyLength]byte{ + bytesutil.ToBytes48(pubkey), + } + statuses, err := km.AddPublicKeys(ctx, publicKeys) + require.NoError(t, err) + for _, status := range statuses { + require.Equal(t, ethpbservice.ImportedRemoteKeysStatus_IMPORTED, status.Status) + } + statuses, err = km.AddPublicKeys(ctx, publicKeys) + require.NoError(t, err) + for _, status := range statuses { + require.Equal(t, ethpbservice.ImportedRemoteKeysStatus_DUPLICATE, status.Status) + } +} + +func TestKeymanager_DeletePublicKeys(t *testing.T) { + ctx := context.Background() + root, err := hexutil.Decode("0x270d43e74ce340de4bca2b1936beca0f4f5408d9e78aec4850920baf659d5b69") + if err != nil { + fmt.Printf("error: %v", err) + } + config := &SetupConfig{ + BaseEndpoint: "http://example.com", + GenesisValidatorsRoot: root, + } + km, err := NewKeymanager(ctx, config) + if err != nil { + fmt.Printf("error: %v", err) + } + pubkey, err := hexutil.Decode("0xa2b5aaad9c6efefe7bb9b1243a043404f3362937cfb6b31833929833173f476630ea2cfeb0d9ddf15f97ca8685948820") + require.NoError(t, err) + publicKeys := [][fieldparams.BLSPubkeyLength]byte{ + bytesutil.ToBytes48(pubkey), + } + statuses, err := km.AddPublicKeys(ctx, publicKeys) + require.NoError(t, err) + for _, status := range statuses { + require.Equal(t, ethpbservice.ImportedRemoteKeysStatus_IMPORTED, status.Status) + } + + s, err := km.DeletePublicKeys(ctx, publicKeys) + require.NoError(t, err) + for _, status := range s { + require.Equal(t, ethpbservice.DeletedRemoteKeysStatus_DELETED, status.Status) + } + + s, err = km.DeletePublicKeys(ctx, publicKeys) + require.NoError(t, err) + for _, status := range s { + require.Equal(t, ethpbservice.DeletedRemoteKeysStatus_NOT_FOUND, status.Status) + } +} diff --git a/validator/keymanager/types.go b/validator/keymanager/types.go index 56482d72ab46..93d6f177882d 100644 --- a/validator/keymanager/types.go +++ b/validator/keymanager/types.go @@ -60,6 +60,16 @@ type KeyStoreExtractor interface { ExtractKeystores(ctx context.Context, publicKeys []bls.PublicKey, password string) ([]*Keystore, error) } +// PublicKeyAdder allows adding public keys to the keymanager. +type PublicKeyAdder interface { + AddPublicKeys(ctx context.Context, publicKeys [][fieldparams.BLSPubkeyLength]byte) ([]*ethpbservice.ImportedRemoteKeysStatus, error) +} + +// PublicKeyDeleter allows deleting public keys set in keymanager. +type PublicKeyDeleter interface { + DeletePublicKeys(ctx context.Context, publicKeys [][fieldparams.BLSPubkeyLength]byte) ([]*ethpbservice.DeletedRemoteKeysStatus, error) +} + type ListKeymanagerAccountConfig struct { ShowDepositData bool ShowPrivateKeys bool diff --git a/validator/keymanager/types_test.go b/validator/keymanager/types_test.go index f1b6bda16ccb..68185269e51d 100644 --- a/validator/keymanager/types_test.go +++ b/validator/keymanager/types_test.go @@ -11,6 +11,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/local" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + remote_web3signer "github.com/prysmaticlabs/prysm/validator/keymanager/remote-web3signer" ) var ( @@ -25,6 +26,9 @@ var ( _ = keymanager.Importer(&derived.Keymanager{}) _ = keymanager.Deleter(&local.Keymanager{}) _ = keymanager.Deleter(&derived.Keymanager{}) + + _ = keymanager.PublicKeyAdder(&remote_web3signer.Keymanager{}) + _ = keymanager.PublicKeyDeleter(&remote_web3signer.Keymanager{}) ) func TestKeystoreContainsPath(t *testing.T) { diff --git a/validator/node/node.go b/validator/node/node.go index 4a14bc2413cd..4ed76e654e73 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -117,7 +117,7 @@ func NewValidatorClient(cliCtx *cli.Context) (*ValidatorClient, error) { // client via a web portal, we start the validator client in a different way. if cliCtx.IsSet(flags.EnableWebFlag.Name) { if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) || cliCtx.IsSet(flags.Web3SignerPublicValidatorKeysFlag.Name) { - return nil, errors.New("web3signer cannot be used with --web") + log.Warn("Remote Keymanager API enabled. Prysm web does not properly support web3signer at this time") } log.Info("Enabling web portal to manage the validator client") if err := validatorClient.initializeForWeb(cliCtx); err != nil { @@ -191,12 +191,8 @@ func (c *ValidatorClient) initializeFromCLI(cliCtx *cli.Context) error { dataDir := cliCtx.String(flags.WalletDirFlag.Name) if !cliCtx.IsSet(flags.InteropNumValidators.Name) { // Custom Check For Web3Signer - if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) || cliCtx.IsSet(flags.Web3SignerPublicValidatorKeysFlag.Name) { - if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) && cliCtx.IsSet(flags.Web3SignerPublicValidatorKeysFlag.Name) { - c.wallet = wallet.NewWalletForWeb3Signer() - } else { - return errors.New("--validators-external-signer-url and --validators-external-signer-public-keys must be used together") - } + if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) { + c.wallet = wallet.NewWalletForWeb3Signer() } else { w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) { return nil, wallet.ErrNoWalletFound @@ -275,24 +271,28 @@ func (c *ValidatorClient) initializeFromCLI(cliCtx *cli.Context) error { func (c *ValidatorClient) initializeForWeb(cliCtx *cli.Context) error { var err error + dataDir := cliCtx.String(flags.WalletDirFlag.Name) + if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) { + c.wallet = wallet.NewWalletForWeb3Signer() + } else { + // Read the wallet password file from the cli context. + if err = setWalletPasswordFilePath(cliCtx); err != nil { + return errors.Wrap(err, "could not read wallet password file") + } - // Read the wallet password file from the cli context. - if err = setWalletPasswordFilePath(cliCtx); err != nil { - return errors.Wrap(err, "could not read wallet password file") + // Read the wallet from the specified path. + w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) { + return nil, nil + }) + if err != nil { + return errors.Wrap(err, "could not open wallet") + } + c.wallet = w + if c.wallet != nil { + dataDir = c.wallet.AccountsDir() + } } - // Read the wallet from the specified path. - w, err := wallet.OpenWalletOrElseCli(cliCtx, func(cliCtx *cli.Context) (*wallet.Wallet, error) { - return nil, nil - }) - if err != nil { - return errors.Wrap(err, "could not open wallet") - } - c.wallet = w - dataDir := cliCtx.String(flags.WalletDirFlag.Name) - if c.wallet != nil { - dataDir = c.wallet.AccountsDir() - } if cliCtx.String(cmd.DataDirFlag.Name) != cmd.DefaultDataDir() { dataDir = cliCtx.String(cmd.DataDirFlag.Name) } @@ -439,9 +439,8 @@ func (c *ValidatorClient) registerValidatorService(cliCtx *cli.Context) error { func web3SignerConfig(cliCtx *cli.Context) (*remote_web3signer.SetupConfig, error) { var web3signerConfig *remote_web3signer.SetupConfig - if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) && cliCtx.IsSet(flags.Web3SignerPublicValidatorKeysFlag.Name) { + if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) { urlStr := cliCtx.String(flags.Web3SignerURLFlag.Name) - publicKeysStr := cliCtx.String(flags.Web3SignerPublicValidatorKeysFlag.Name) u, err := url.ParseRequestURI(urlStr) if err != nil { return nil, errors.Wrapf(err, "web3signer url %s is invalid", urlStr) @@ -453,19 +452,22 @@ func web3SignerConfig(cliCtx *cli.Context) (*remote_web3signer.SetupConfig, erro BaseEndpoint: u.String(), GenesisValidatorsRoot: nil, } - pURL, err := url.ParseRequestURI(publicKeysStr) - if err == nil && pURL.Scheme != "" && pURL.Host != "" { - web3signerConfig.PublicKeysURL = publicKeysStr - } else { - var validatorKeys [][48]byte - for _, key := range strings.Split(publicKeysStr, ",") { - decodedKey, decodeErr := hexutil.Decode(key) - if decodeErr != nil { - return nil, errors.Wrapf(decodeErr, "could not decode public key for web3signer: %s", key) + if cliCtx.IsSet(flags.Web3SignerPublicValidatorKeysFlag.Name) { + publicKeysStr := cliCtx.String(flags.Web3SignerPublicValidatorKeysFlag.Name) + pURL, err := url.ParseRequestURI(publicKeysStr) + if err == nil && pURL.Scheme != "" && pURL.Host != "" { + web3signerConfig.PublicKeysURL = publicKeysStr + } else { + var validatorKeys [][48]byte + for _, key := range strings.Split(publicKeysStr, ",") { + decodedKey, decodeErr := hexutil.Decode(key) + if decodeErr != nil { + return nil, errors.Wrapf(decodeErr, "could not decode public key for web3signer: %s", key) + } + validatorKeys = append(validatorKeys, bytesutil.ToBytes48(decodedKey)) } - validatorKeys = append(validatorKeys, bytesutil.ToBytes48(decodedKey)) + web3signerConfig.ProvidedPublicKeys = validatorKeys } - web3signerConfig.ProvidedPublicKeys = validatorKeys } } return web3signerConfig, nil diff --git a/validator/rpc/BUILD.bazel b/validator/rpc/BUILD.bazel index 5eef888998ca..9fb32052d4f4 100644 --- a/validator/rpc/BUILD.bazel +++ b/validator/rpc/BUILD.bazel @@ -112,6 +112,7 @@ go_test( "//validator/keymanager/remote-web3signer:go_default_library", "//validator/slashing-protection-history/format:go_default_library", "//validator/testing:go_default_library", + "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_golang_jwt_jwt_v4//:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_google_uuid//:go_default_library", diff --git a/validator/rpc/apimiddleware/endpoint_factory.go b/validator/rpc/apimiddleware/endpoint_factory.go index dee975556c61..7ec1f8196f59 100644 --- a/validator/rpc/apimiddleware/endpoint_factory.go +++ b/validator/rpc/apimiddleware/endpoint_factory.go @@ -17,6 +17,7 @@ func (f *ValidatorEndpointFactory) IsNil() bool { func (*ValidatorEndpointFactory) Paths() []string { return []string{ "/eth/v1/keystores", + "/eth/v1/remotekeys", } } @@ -30,6 +31,12 @@ func (*ValidatorEndpointFactory) Create(path string) (*apimiddleware.Endpoint, e endpoint.PostResponse = &importKeystoresResponseJson{} endpoint.DeleteRequest = &deleteKeystoresRequestJson{} endpoint.DeleteResponse = &deleteKeystoresResponseJson{} + case "/eth/v1/remotekeys": + endpoint.GetResponse = &listRemoteKeysResponseJson{} + endpoint.PostRequest = &importRemoteKeysRequestJson{} + endpoint.PostResponse = &importRemoteKeysResponseJson{} + endpoint.DeleteRequest = &deleteRemoteKeysRequestJson{} + endpoint.DeleteResponse = &deleteRemoteKeysResponseJson{} default: return nil, errors.New("invalid path") } diff --git a/validator/rpc/apimiddleware/structs.go b/validator/rpc/apimiddleware/structs.go index 58ad4c5b58b0..98f0ea7b5d96 100644 --- a/validator/rpc/apimiddleware/structs.go +++ b/validator/rpc/apimiddleware/structs.go @@ -32,3 +32,37 @@ type deleteKeystoresResponseJson struct { Statuses []*statusJson `json:"data"` SlashingProtection string `json:"slashing_protection"` } + +//remote keymanager api + +type listRemoteKeysResponseJson struct { + Keystores []*remoteKeysListJson `json:"data"` +} + +type remoteKeysListJson struct { + Pubkey string `json:"pubkey" hex:"true"` + Url string `json:"url"` + Readonly bool `json:"readonly"` +} + +type remoteKeysJson struct { + Pubkey string `json:"pubkey" hex:"true"` + Url string `json:"url"` + Readonly bool `json:"readonly"` +} + +type importRemoteKeysRequestJson struct { + Keystores []*remoteKeysJson `json:"remote_keys"` +} + +type importRemoteKeysResponseJson struct { + Statuses []*statusJson `json:"data"` +} + +type deleteRemoteKeysRequestJson struct { + PublicKeys []string `json:"pubkeys" hex:"true"` +} + +type deleteRemoteKeysResponseJson struct { + Statuses []*statusJson `json:"data"` +} diff --git a/validator/rpc/apimiddleware/structs_test.go b/validator/rpc/apimiddleware/structs_test.go index 276d36d04d97..e0aa5f17a4f7 100644 --- a/validator/rpc/apimiddleware/structs_test.go +++ b/validator/rpc/apimiddleware/structs_test.go @@ -118,6 +118,116 @@ func TestDeleteKeystores_JSONisEqual(t *testing.T) { } +func TestListRemoteKeys_JSONisEqual(t *testing.T) { + middlewareResponse := &listRemoteKeysResponseJson{ + Keystores: []*remoteKeysListJson{ + &remoteKeysListJson{ + Pubkey: "0x0", + Url: "http://localhost:8080", + Readonly: true, + }, + }, + } + + protoResponse := &service.ListRemoteKeysResponse{ + Data: []*service.ListRemoteKeysResponse_Keystore{ + &service.ListRemoteKeysResponse_Keystore{ + Pubkey: make([]byte, fieldparams.BLSPubkeyLength), + Url: "http://localhost:8080", + Readonly: true, + }, + }, + } + + listResp, err := areJsonPropertyNamesEqual(middlewareResponse, protoResponse) + require.NoError(t, err) + require.Equal(t, listResp, true) + + resp, err := areJsonPropertyNamesEqual(middlewareResponse.Keystores[0], protoResponse.Data[0]) + require.NoError(t, err) + require.Equal(t, resp, true) +} + +func TestImportRemoteKeys_JSONisEqual(t *testing.T) { + importKeystoresRequest := &importRemoteKeysRequestJson{} + + protoImportRequest := &service.ImportRemoteKeysRequest{ + RemoteKeys: []*service.ImportRemoteKeysRequest_Keystore{ + &service.ImportRemoteKeysRequest_Keystore{ + Pubkey: make([]byte, fieldparams.BLSPubkeyLength), + Url: "http://localhost:8080", + }, + }, + } + + requestResp, err := areJsonPropertyNamesEqual(importKeystoresRequest, protoImportRequest) + require.NoError(t, err) + require.Equal(t, requestResp, true) + + importKeystoresResponse := &importRemoteKeysResponseJson{ + Statuses: []*statusJson{ + &statusJson{ + Status: "Error", + Message: "a", + }, + }, + } + + protoImportKeystoresResponse := &service.ImportRemoteKeysResponse{ + Data: []*service.ImportedRemoteKeysStatus{ + &service.ImportedRemoteKeysStatus{ + Status: service.ImportedRemoteKeysStatus_ERROR, + Message: "a", + }, + }, + } + + ImportResp, err := areJsonPropertyNamesEqual(importKeystoresResponse, protoImportKeystoresResponse) + require.NoError(t, err) + require.Equal(t, ImportResp, true) + + resp, err := areJsonPropertyNamesEqual(importKeystoresResponse.Statuses[0], protoImportKeystoresResponse.Data[0]) + require.NoError(t, err) + require.Equal(t, resp, true) +} + +func TestDeleteRemoteKeys_JSONisEqual(t *testing.T) { + deleteKeystoresRequest := &deleteRemoteKeysRequestJson{} + + protoDeleteRequest := &service.DeleteRemoteKeysRequest{ + Pubkeys: [][]byte{[]byte{}}, + } + + requestResp, err := areJsonPropertyNamesEqual(deleteKeystoresRequest, protoDeleteRequest) + require.NoError(t, err) + require.Equal(t, requestResp, true) + + deleteKeystoresResponse := &deleteRemoteKeysResponseJson{ + Statuses: []*statusJson{ + &statusJson{ + Status: "Error", + Message: "a", + }, + }, + } + protoDeleteResponse := &service.DeleteRemoteKeysResponse{ + Data: []*service.DeletedRemoteKeysStatus{ + &service.DeletedRemoteKeysStatus{ + Status: service.DeletedRemoteKeysStatus_ERROR, + Message: "a", + }, + }, + } + + deleteResp, err := areJsonPropertyNamesEqual(deleteKeystoresResponse, protoDeleteResponse) + require.NoError(t, err) + require.Equal(t, deleteResp, true) + + resp, err := areJsonPropertyNamesEqual(deleteKeystoresResponse.Statuses[0], protoDeleteResponse.Data[0]) + require.NoError(t, err) + require.Equal(t, resp, true) +} + // note: this does not do a deep comparison of the structs func areJsonPropertyNamesEqual(internal, proto interface{}) (bool, error) { internalJSON, err := json.Marshal(internal) diff --git a/validator/rpc/standard_api.go b/validator/rpc/standard_api.go index ae9b45d1e477..61088da6c420 100644 --- a/validator/rpc/standard_api.go +++ b/validator/rpc/standard_api.go @@ -30,7 +30,7 @@ func (s *Server) ListKeystores( } km, err := s.validatorService.Keymanager() if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get Prysm keymanager: %v", err) + return nil, status.Errorf(codes.Internal, "Could not get Prysm keymanager (possibly due to beacon node unavailable): %v", err) } if s.wallet.KeymanagerKind() != keymanager.Derived && s.wallet.KeymanagerKind() != keymanager.Local { return nil, status.Errorf(codes.FailedPrecondition, "Prysm validator keys are not stored locally with this keymanager type.") @@ -67,7 +67,7 @@ func (s *Server) ImportKeystores( } km, err := s.validatorService.Keymanager() if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get keymanager: %v", err) + return nil, status.Errorf(codes.Internal, "Could not get keymanager (possibly due to beacon node unavailable): %v", err) } importer, ok := km.(keymanager.Importer) if !ok { @@ -150,7 +150,7 @@ func (s *Server) DeleteKeystores( } km, err := s.validatorService.Keymanager() if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get keymanager: %v", err) + return nil, status.Errorf(codes.Internal, "Could not get keymanager (possibly due to beacon node unavailable): %v", err) } if len(req.Pubkeys) == 0 { return ðpbservice.DeleteKeystoresResponse{Data: make([]*ethpbservice.DeletedKeystoreStatus, 0)}, nil @@ -251,3 +251,134 @@ func (s *Server) slashingProtectionHistoryForDeletedKeys( } return slashingprotection.ExportStandardProtectionJSON(ctx, s.valDB, filteredKeys...) } + +// ListRemoteKeys returns a list of all public keys defined for web3signer keymanager type. +func (s *Server) ListRemoteKeys(ctx context.Context, _ *empty.Empty) (*ethpbservice.ListRemoteKeysResponse, error) { + if !s.walletInitialized { + return nil, status.Error(codes.FailedPrecondition, "Prysm Wallet not initialized. Please create a new wallet.") + } + if s.validatorService == nil { + return nil, status.Error(codes.FailedPrecondition, "Validator service not ready.") + } + km, err := s.validatorService.Keymanager() + if err != nil { + return nil, status.Errorf(codes.Internal, "Could not get Prysm keymanager (possibly due to beacon node unavailable): %v", err) + } + if s.wallet.KeymanagerKind() != keymanager.Web3Signer { + return nil, status.Errorf(codes.FailedPrecondition, "Prysm Wallet is not of type Web3Signer. Please execute validator client with web3signer flags.") + } + pubKeys, err := km.FetchValidatingPublicKeys(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "Could not retrieve keystores: %v", err) + } + keystoreResponse := make([]*ethpbservice.ListRemoteKeysResponse_Keystore, len(pubKeys)) + for i := 0; i < len(pubKeys); i++ { + keystoreResponse[i] = ðpbservice.ListRemoteKeysResponse_Keystore{ + Pubkey: pubKeys[i][:], + Url: s.validatorService.Web3SignerConfig.BaseEndpoint, + Readonly: true, + } + } + return ðpbservice.ListRemoteKeysResponse{ + Data: keystoreResponse, + }, nil +} + +// ImportRemoteKeys imports a list of public keys defined for web3signer keymanager type. +func (s *Server) ImportRemoteKeys(ctx context.Context, req *ethpbservice.ImportRemoteKeysRequest) (*ethpbservice.ImportRemoteKeysResponse, error) { + if !s.walletInitialized { + return nil, status.Error(codes.FailedPrecondition, "Prysm Wallet not initialized. Please create a new wallet.") + } + if s.validatorService == nil { + return nil, status.Error(codes.FailedPrecondition, "Validator service not ready.") + } + km, err := s.validatorService.Keymanager() + if err != nil { + return nil, status.Errorf(codes.Internal, fmt.Sprintf("Could not get Prysm keymanager (possibly due to beacon node unavailable): %v", err)) + } + if s.wallet.KeymanagerKind() != keymanager.Web3Signer { + return nil, status.Errorf(codes.FailedPrecondition, "Prysm Wallet is not of type Web3Signer. Please execute validator client with web3signer flags.") + } + adder, ok := km.(keymanager.PublicKeyAdder) + if !ok { + statuses := groupImportRemoteKeysErrors(req, "Keymanager kind cannot import public keys for web3signer keymanager type.") + return ðpbservice.ImportRemoteKeysResponse{Data: statuses}, nil + } + + remoteKeys := make([][fieldparams.BLSPubkeyLength]byte, len(req.RemoteKeys)) + isUrlUsed := false + for i, obj := range req.RemoteKeys { + remoteKeys[i] = bytesutil.ToBytes48(obj.Pubkey) + if obj.Url != "" { + isUrlUsed = true + } + } + if isUrlUsed { + log.Warnf("Setting web3signer base url for imported keys is not supported. Prysm only uses the url from --validators-external-signer-url flag for web3signer.") + } + + statuses, err := adder.AddPublicKeys(ctx, remoteKeys) + if err != nil { + sts := groupImportRemoteKeysErrors(req, fmt.Sprintf("Could not add keys;error: %v", err)) + return ðpbservice.ImportRemoteKeysResponse{Data: sts}, nil + } + return ðpbservice.ImportRemoteKeysResponse{ + Data: statuses, + }, nil +} + +func groupImportRemoteKeysErrors(req *ethpbservice.ImportRemoteKeysRequest, errorMessage string) []*ethpbservice.ImportedRemoteKeysStatus { + statuses := make([]*ethpbservice.ImportedRemoteKeysStatus, len(req.RemoteKeys)) + for i := 0; i < len(req.RemoteKeys); i++ { + statuses[i] = ðpbservice.ImportedRemoteKeysStatus{ + Status: ethpbservice.ImportedRemoteKeysStatus_ERROR, + Message: errorMessage, + } + } + return statuses +} + +// DeleteRemoteKeys deletes a list of public keys defined for web3signer keymanager type. +func (s *Server) DeleteRemoteKeys(ctx context.Context, req *ethpbservice.DeleteRemoteKeysRequest) (*ethpbservice.DeleteRemoteKeysResponse, error) { + if !s.walletInitialized { + return nil, status.Error(codes.FailedPrecondition, "Prysm Wallet not initialized. Please create a new wallet.") + } + if s.validatorService == nil { + return nil, status.Error(codes.FailedPrecondition, "Validator service not ready.") + } + km, err := s.validatorService.Keymanager() + if err != nil { + return nil, status.Errorf(codes.Internal, "Could not get Prysm keymanager (possibly due to beacon node unavailable): %v", err) + } + if s.wallet.KeymanagerKind() != keymanager.Web3Signer { + return nil, status.Errorf(codes.FailedPrecondition, "Prysm Wallet is not of type Web3Signer. Please execute validator client with web3signer flags.") + } + deleter, ok := km.(keymanager.PublicKeyDeleter) + if !ok { + statuses := groupDeleteRemoteKeysErrors(req, "Keymanager kind cannot delete public keys for web3signer keymanager type.") + return ðpbservice.DeleteRemoteKeysResponse{Data: statuses}, nil + } + remoteKeys := make([][fieldparams.BLSPubkeyLength]byte, len(req.Pubkeys)) + for i, key := range req.Pubkeys { + remoteKeys[i] = bytesutil.ToBytes48(key) + } + statuses, err := deleter.DeletePublicKeys(ctx, remoteKeys) + if err != nil { + sts := groupDeleteRemoteKeysErrors(req, fmt.Sprintf("Could not delete keys;error: %v", err)) + return ðpbservice.DeleteRemoteKeysResponse{Data: sts}, nil + } + return ðpbservice.DeleteRemoteKeysResponse{ + Data: statuses, + }, nil +} + +func groupDeleteRemoteKeysErrors(req *ethpbservice.DeleteRemoteKeysRequest, errorMessage string) []*ethpbservice.DeletedRemoteKeysStatus { + statuses := make([]*ethpbservice.DeletedRemoteKeysStatus, len(req.Pubkeys)) + for i := 0; i < len(req.Pubkeys); i++ { + statuses[i] = ðpbservice.DeletedRemoteKeysStatus{ + Status: ethpbservice.DeletedRemoteKeysStatus_ERROR, + Message: errorMessage, + } + } + return statuses +} diff --git a/validator/rpc/standard_api_test.go b/validator/rpc/standard_api_test.go index f7aa200873ec..0d44eadc4f7f 100644 --- a/validator/rpc/standard_api_test.go +++ b/validator/rpc/standard_api_test.go @@ -7,6 +7,7 @@ import ( "fmt" "testing" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/golang/protobuf/ptypes/empty" "github.com/google/uuid" fieldparams "github.com/prysmaticlabs/prysm/config/fieldparams" @@ -524,3 +525,158 @@ func createRandomKeystore(t testing.TB, password string) *keymanager.Keystore { Name: encryptor.Name(), } } + +func TestServer_ListRemoteKeys(t *testing.T) { + t.Run("wallet not ready", func(t *testing.T) { + s := Server{} + _, err := s.ListKeystores(context.Background(), &empty.Empty{}) + require.ErrorContains(t, "Prysm Wallet not initialized. Please create a new wallet.", err) + }) + ctx := context.Background() + w := wallet.NewWalletForWeb3Signer() + root := make([]byte, fieldparams.RootLength) + root[0] = 1 + bytevalue, err := hexutil.Decode("0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a") + require.NoError(t, err) + pubkeys := [][fieldparams.BLSPubkeyLength]byte{bytesutil.ToBytes48(bytevalue)} + config := &remote_web3signer.SetupConfig{ + BaseEndpoint: "http://example.com", + GenesisValidatorsRoot: root, + ProvidedPublicKeys: pubkeys, + } + km, err := w.InitializeKeymanager(ctx, iface.InitKeymanagerConfig{ListenForChanges: false, Web3SignerConfig: config}) + require.NoError(t, err) + vs, err := client.NewValidatorService(ctx, &client.Config{ + Wallet: w, + Validator: &mock.MockValidator{ + Km: km, + }, + Web3SignerConfig: config, + }) + require.NoError(t, err) + s := &Server{ + walletInitialized: true, + wallet: w, + validatorService: vs, + } + expectedKeys, err := km.FetchValidatingPublicKeys(ctx) + require.NoError(t, err) + + t.Run("returns proper data with existing pub keystores", func(t *testing.T) { + resp, err := s.ListRemoteKeys(context.Background(), &empty.Empty{}) + require.NoError(t, err) + for i := 0; i < len(resp.Data); i++ { + require.DeepEqual(t, expectedKeys[i][:], resp.Data[i].Pubkey) + } + }) +} + +func TestServer_ImportRemoteKeys(t *testing.T) { + t.Run("wallet not ready", func(t *testing.T) { + s := Server{} + _, err := s.ListKeystores(context.Background(), &empty.Empty{}) + require.ErrorContains(t, "Prysm Wallet not initialized. Please create a new wallet.", err) + }) + ctx := context.Background() + w := wallet.NewWalletForWeb3Signer() + root := make([]byte, fieldparams.RootLength) + root[0] = 1 + config := &remote_web3signer.SetupConfig{ + BaseEndpoint: "http://example.com", + GenesisValidatorsRoot: root, + ProvidedPublicKeys: nil, + } + km, err := w.InitializeKeymanager(ctx, iface.InitKeymanagerConfig{ListenForChanges: false, Web3SignerConfig: config}) + require.NoError(t, err) + vs, err := client.NewValidatorService(ctx, &client.Config{ + Wallet: w, + Validator: &mock.MockValidator{ + Km: km, + }, + Web3SignerConfig: config, + }) + require.NoError(t, err) + s := &Server{ + walletInitialized: true, + wallet: w, + validatorService: vs, + } + bytevalue, err := hexutil.Decode("0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a") + require.NoError(t, err) + remoteKeys := []*ethpbservice.ImportRemoteKeysRequest_Keystore{ + { + Pubkey: bytevalue, + }, + } + + t.Run("returns proper data with existing pub keystores", func(t *testing.T) { + resp, err := s.ImportRemoteKeys(context.Background(), ðpbservice.ImportRemoteKeysRequest{ + RemoteKeys: remoteKeys, + }) + expectedStatuses := []*ethpbservice.ImportedRemoteKeysStatus{ + ðpbservice.ImportedRemoteKeysStatus{ + Status: ethpbservice.ImportedRemoteKeysStatus_IMPORTED, + Message: fmt.Sprintf("Successfully added pubkey: %v", hexutil.Encode(bytevalue)), + }, + } + require.NoError(t, err) + for i := 0; i < len(resp.Data); i++ { + require.DeepEqual(t, expectedStatuses[i], resp.Data[i]) + } + }) +} + +func TestServer_DeleteRemoteKeys(t *testing.T) { + t.Run("wallet not ready", func(t *testing.T) { + s := Server{} + _, err := s.ListKeystores(context.Background(), &empty.Empty{}) + require.ErrorContains(t, "Prysm Wallet not initialized. Please create a new wallet.", err) + }) + ctx := context.Background() + w := wallet.NewWalletForWeb3Signer() + root := make([]byte, fieldparams.RootLength) + root[0] = 1 + bytevalue, err := hexutil.Decode("0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a") + require.NoError(t, err) + pubkeys := [][fieldparams.BLSPubkeyLength]byte{bytesutil.ToBytes48(bytevalue)} + config := &remote_web3signer.SetupConfig{ + BaseEndpoint: "http://example.com", + GenesisValidatorsRoot: root, + ProvidedPublicKeys: pubkeys, + } + km, err := w.InitializeKeymanager(ctx, iface.InitKeymanagerConfig{ListenForChanges: false, Web3SignerConfig: config}) + require.NoError(t, err) + vs, err := client.NewValidatorService(ctx, &client.Config{ + Wallet: w, + Validator: &mock.MockValidator{ + Km: km, + }, + Web3SignerConfig: config, + }) + require.NoError(t, err) + s := &Server{ + walletInitialized: true, + wallet: w, + validatorService: vs, + } + + t.Run("returns proper data with existing pub keystores", func(t *testing.T) { + resp, err := s.DeleteRemoteKeys(context.Background(), ðpbservice.DeleteRemoteKeysRequest{ + Pubkeys: [][]byte{bytevalue}, + }) + expectedStatuses := []*ethpbservice.DeletedRemoteKeysStatus{ + ðpbservice.DeletedRemoteKeysStatus{ + Status: ethpbservice.DeletedRemoteKeysStatus_DELETED, + Message: fmt.Sprintf("Successfully deleted pubkey: %v", hexutil.Encode(bytevalue)), + }, + } + require.NoError(t, err) + for i := 0; i < len(resp.Data); i++ { + require.DeepEqual(t, expectedStatuses[i], resp.Data[i]) + + } + expectedKeys, err := km.FetchValidatingPublicKeys(ctx) + require.NoError(t, err) + require.Equal(t, 0, len(expectedKeys)) + }) +}