From 382386733d89655fed83ef98a89adb472ad7a754 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 6 Dec 2025 08:39:40 -0800 Subject: [PATCH] feat: add keygen_session_id to signing session flow - Add keygen_session_id field to CreateSessionRequest and SessionInfo protobuf - Modify CreateSigningSessionAuto to accept and pass keygenSessionID - Update Account Handler to pass account's keygen_session_id when creating signing session - This enables parties to load the correct keyshare by session ID --- backend/.claude/settings.local.json | 4 +- .../api/proto/session_coordinator.pb.go | 1760 +++++++++++++++++ .../api/proto/session_coordinator.proto | 4 + .../api/proto/session_coordinator_grpc.pb.go | 395 ++++ .../adapters/input/http/account_handler.go | 1 + .../output/grpc/session_coordinator_client.go | 2 + .../use_cases/participate_keygen.go | 13 +- .../use_cases/participate_signing.go | 56 +- backend/mpc-system/test_create_session.go | 7 +- backend/mpc-system/test_signing.go | 3 +- 10 files changed, 2228 insertions(+), 17 deletions(-) create mode 100644 backend/mpc-system/api/proto/session_coordinator.pb.go create mode 100644 backend/mpc-system/api/proto/session_coordinator_grpc.pb.go diff --git a/backend/.claude/settings.local.json b/backend/.claude/settings.local.json index 5a9a367c..818b4770 100644 --- a/backend/.claude/settings.local.json +++ b/backend/.claude/settings.local.json @@ -26,7 +26,9 @@ "Bash(copy /Y \"api\\proto\\session_coordinator.pb.go\" \"api\\grpc\\coordinator\\v1\"\" && copy /Y \"apiprotosession_coordinator_grpc.pb.go\" \"apigrpccoordinatorv1\"\")", "Bash(timeout /t 10 /nobreak)", "Bash(bash scripts/deploy.sh:*)", - "Bash(go run:*)" + "Bash(go run:*)", + "Bash(timeout /t 5 /nobreak)", + "Bash(bash:*)" ], "deny": [], "ask": [] diff --git a/backend/mpc-system/api/proto/session_coordinator.pb.go b/backend/mpc-system/api/proto/session_coordinator.pb.go new file mode 100644 index 00000000..86f1a184 --- /dev/null +++ b/backend/mpc-system/api/proto/session_coordinator.pb.go @@ -0,0 +1,1760 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v6.33.1 +// source: api/proto/session_coordinator.proto + +package coordinator + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// CreateSessionRequest creates a new MPC session +type CreateSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionType string `protobuf:"bytes,1,opt,name=session_type,json=sessionType,proto3" json:"session_type,omitempty"` // "keygen" or "sign" + ThresholdN int32 `protobuf:"varint,2,opt,name=threshold_n,json=thresholdN,proto3" json:"threshold_n,omitempty"` // Total number of parties + ThresholdT int32 `protobuf:"varint,3,opt,name=threshold_t,json=thresholdT,proto3" json:"threshold_t,omitempty"` // Minimum required parties + Participants []*ParticipantInfo `protobuf:"bytes,4,rep,name=participants,proto3" json:"participants,omitempty"` // Optional: if empty, coordinator selects automatically + MessageHash []byte `protobuf:"bytes,5,opt,name=message_hash,json=messageHash,proto3" json:"message_hash,omitempty"` // Required for sign sessions + ExpiresInSeconds int64 `protobuf:"varint,6,opt,name=expires_in_seconds,json=expiresInSeconds,proto3" json:"expires_in_seconds,omitempty"` // Session expiration time + PartyComposition *PartyComposition `protobuf:"bytes,7,opt,name=party_composition,json=partyComposition,proto3" json:"party_composition,omitempty"` // Optional: party composition requirements for auto-selection + // For sign sessions with delegate party: user must provide their encrypted share + DelegateUserShare *DelegateUserShare `protobuf:"bytes,8,opt,name=delegate_user_share,json=delegateUserShare,proto3" json:"delegate_user_share,omitempty"` + // For sign sessions: which keygen session's shares to use + KeygenSessionId string `protobuf:"bytes,9,opt,name=keygen_session_id,json=keygenSessionId,proto3" json:"keygen_session_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSessionRequest) Reset() { + *x = CreateSessionRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionRequest) ProtoMessage() {} + +func (x *CreateSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateSessionRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateSessionRequest) GetSessionType() string { + if x != nil { + return x.SessionType + } + return "" +} + +func (x *CreateSessionRequest) GetThresholdN() int32 { + if x != nil { + return x.ThresholdN + } + return 0 +} + +func (x *CreateSessionRequest) GetThresholdT() int32 { + if x != nil { + return x.ThresholdT + } + return 0 +} + +func (x *CreateSessionRequest) GetParticipants() []*ParticipantInfo { + if x != nil { + return x.Participants + } + return nil +} + +func (x *CreateSessionRequest) GetMessageHash() []byte { + if x != nil { + return x.MessageHash + } + return nil +} + +func (x *CreateSessionRequest) GetExpiresInSeconds() int64 { + if x != nil { + return x.ExpiresInSeconds + } + return 0 +} + +func (x *CreateSessionRequest) GetPartyComposition() *PartyComposition { + if x != nil { + return x.PartyComposition + } + return nil +} + +func (x *CreateSessionRequest) GetDelegateUserShare() *DelegateUserShare { + if x != nil { + return x.DelegateUserShare + } + return nil +} + +func (x *CreateSessionRequest) GetKeygenSessionId() string { + if x != nil { + return x.KeygenSessionId + } + return "" +} + +// DelegateUserShare contains user's share for delegate party to use in signing +type DelegateUserShare struct { + state protoimpl.MessageState `protogen:"open.v1"` + DelegatePartyId string `protobuf:"bytes,1,opt,name=delegate_party_id,json=delegatePartyId,proto3" json:"delegate_party_id,omitempty"` // The delegate party that will use this share + EncryptedShare []byte `protobuf:"bytes,2,opt,name=encrypted_share,json=encryptedShare,proto3" json:"encrypted_share,omitempty"` // User's encrypted share (same as received from keygen) + PartyIndex int32 `protobuf:"varint,3,opt,name=party_index,json=partyIndex,proto3" json:"party_index,omitempty"` // Party index for this share + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DelegateUserShare) Reset() { + *x = DelegateUserShare{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DelegateUserShare) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DelegateUserShare) ProtoMessage() {} + +func (x *DelegateUserShare) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DelegateUserShare.ProtoReflect.Descriptor instead. +func (*DelegateUserShare) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{1} +} + +func (x *DelegateUserShare) GetDelegatePartyId() string { + if x != nil { + return x.DelegatePartyId + } + return "" +} + +func (x *DelegateUserShare) GetEncryptedShare() []byte { + if x != nil { + return x.EncryptedShare + } + return nil +} + +func (x *DelegateUserShare) GetPartyIndex() int32 { + if x != nil { + return x.PartyIndex + } + return 0 +} + +// PartyComposition specifies requirements for automatic party selection +type PartyComposition struct { + state protoimpl.MessageState `protogen:"open.v1"` + PersistentCount int32 `protobuf:"varint,1,opt,name=persistent_count,json=persistentCount,proto3" json:"persistent_count,omitempty"` // Number of persistent parties (store shares in DB) + DelegateCount int32 `protobuf:"varint,2,opt,name=delegate_count,json=delegateCount,proto3" json:"delegate_count,omitempty"` // Number of delegate parties (return shares to user) + TemporaryCount int32 `protobuf:"varint,3,opt,name=temporary_count,json=temporaryCount,proto3" json:"temporary_count,omitempty"` // Number of temporary parties + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PartyComposition) Reset() { + *x = PartyComposition{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PartyComposition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartyComposition) ProtoMessage() {} + +func (x *PartyComposition) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartyComposition.ProtoReflect.Descriptor instead. +func (*PartyComposition) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{2} +} + +func (x *PartyComposition) GetPersistentCount() int32 { + if x != nil { + return x.PersistentCount + } + return 0 +} + +func (x *PartyComposition) GetDelegateCount() int32 { + if x != nil { + return x.DelegateCount + } + return 0 +} + +func (x *PartyComposition) GetTemporaryCount() int32 { + if x != nil { + return x.TemporaryCount + } + return 0 +} + +// ParticipantInfo contains information about a participant +type ParticipantInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + PartyId string `protobuf:"bytes,1,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,2,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ParticipantInfo) Reset() { + *x = ParticipantInfo{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ParticipantInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParticipantInfo) ProtoMessage() {} + +func (x *ParticipantInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParticipantInfo.ProtoReflect.Descriptor instead. +func (*ParticipantInfo) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{3} +} + +func (x *ParticipantInfo) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +func (x *ParticipantInfo) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +// DeviceInfo contains device information +type DeviceInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeviceType string `protobuf:"bytes,1,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` // android, ios, pc, server, recovery + DeviceId string `protobuf:"bytes,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + Platform string `protobuf:"bytes,3,opt,name=platform,proto3" json:"platform,omitempty"` + AppVersion string `protobuf:"bytes,4,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceInfo) Reset() { + *x = DeviceInfo{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceInfo) ProtoMessage() {} + +func (x *DeviceInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceInfo.ProtoReflect.Descriptor instead. +func (*DeviceInfo) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{4} +} + +func (x *DeviceInfo) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *DeviceInfo) GetDeviceId() string { + if x != nil { + return x.DeviceId + } + return "" +} + +func (x *DeviceInfo) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *DeviceInfo) GetAppVersion() string { + if x != nil { + return x.AppVersion + } + return "" +} + +// CreateSessionResponse contains the created session info +type CreateSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + JoinTokens map[string]string `protobuf:"bytes,2,rep,name=join_tokens,json=joinTokens,proto3" json:"join_tokens,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // party_id -> join_token + ExpiresAt int64 `protobuf:"varint,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` // Unix timestamp milliseconds + SelectedParties []string `protobuf:"bytes,4,rep,name=selected_parties,json=selectedParties,proto3" json:"selected_parties,omitempty"` // List of selected party IDs + DelegatePartyId string `protobuf:"bytes,5,opt,name=delegate_party_id,json=delegatePartyId,proto3" json:"delegate_party_id,omitempty"` // The delegate party ID (if any) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSessionResponse) Reset() { + *x = CreateSessionResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionResponse) ProtoMessage() {} + +func (x *CreateSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateSessionResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateSessionResponse) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *CreateSessionResponse) GetJoinTokens() map[string]string { + if x != nil { + return x.JoinTokens + } + return nil +} + +func (x *CreateSessionResponse) GetExpiresAt() int64 { + if x != nil { + return x.ExpiresAt + } + return 0 +} + +func (x *CreateSessionResponse) GetSelectedParties() []string { + if x != nil { + return x.SelectedParties + } + return nil +} + +func (x *CreateSessionResponse) GetDelegatePartyId() string { + if x != nil { + return x.DelegatePartyId + } + return "" +} + +// JoinSessionRequest allows a participant to join a session +type JoinSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + PartyId string `protobuf:"bytes,2,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` + JoinToken string `protobuf:"bytes,3,opt,name=join_token,json=joinToken,proto3" json:"join_token,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JoinSessionRequest) Reset() { + *x = JoinSessionRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JoinSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinSessionRequest) ProtoMessage() {} + +func (x *JoinSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinSessionRequest.ProtoReflect.Descriptor instead. +func (*JoinSessionRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{6} +} + +func (x *JoinSessionRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *JoinSessionRequest) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +func (x *JoinSessionRequest) GetJoinToken() string { + if x != nil { + return x.JoinToken + } + return "" +} + +func (x *JoinSessionRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +// JoinSessionResponse contains session information for the joining party +type JoinSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + SessionInfo *SessionInfo `protobuf:"bytes,2,opt,name=session_info,json=sessionInfo,proto3" json:"session_info,omitempty"` + OtherParties []*PartyInfo `protobuf:"bytes,3,rep,name=other_parties,json=otherParties,proto3" json:"other_parties,omitempty"` + PartyIndex int32 `protobuf:"varint,4,opt,name=party_index,json=partyIndex,proto3" json:"party_index,omitempty"` // This party's assigned index + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JoinSessionResponse) Reset() { + *x = JoinSessionResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JoinSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinSessionResponse) ProtoMessage() {} + +func (x *JoinSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinSessionResponse.ProtoReflect.Descriptor instead. +func (*JoinSessionResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{7} +} + +func (x *JoinSessionResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *JoinSessionResponse) GetSessionInfo() *SessionInfo { + if x != nil { + return x.SessionInfo + } + return nil +} + +func (x *JoinSessionResponse) GetOtherParties() []*PartyInfo { + if x != nil { + return x.OtherParties + } + return nil +} + +func (x *JoinSessionResponse) GetPartyIndex() int32 { + if x != nil { + return x.PartyIndex + } + return 0 +} + +// SessionInfo contains session information +type SessionInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + SessionType string `protobuf:"bytes,2,opt,name=session_type,json=sessionType,proto3" json:"session_type,omitempty"` + ThresholdN int32 `protobuf:"varint,3,opt,name=threshold_n,json=thresholdN,proto3" json:"threshold_n,omitempty"` + ThresholdT int32 `protobuf:"varint,4,opt,name=threshold_t,json=thresholdT,proto3" json:"threshold_t,omitempty"` + MessageHash []byte `protobuf:"bytes,5,opt,name=message_hash,json=messageHash,proto3" json:"message_hash,omitempty"` + Status string `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` + // For sign sessions: which keygen session's shares to use + KeygenSessionId string `protobuf:"bytes,7,opt,name=keygen_session_id,json=keygenSessionId,proto3" json:"keygen_session_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionInfo) Reset() { + *x = SessionInfo{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionInfo) ProtoMessage() {} + +func (x *SessionInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionInfo.ProtoReflect.Descriptor instead. +func (*SessionInfo) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{8} +} + +func (x *SessionInfo) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *SessionInfo) GetSessionType() string { + if x != nil { + return x.SessionType + } + return "" +} + +func (x *SessionInfo) GetThresholdN() int32 { + if x != nil { + return x.ThresholdN + } + return 0 +} + +func (x *SessionInfo) GetThresholdT() int32 { + if x != nil { + return x.ThresholdT + } + return 0 +} + +func (x *SessionInfo) GetMessageHash() []byte { + if x != nil { + return x.MessageHash + } + return nil +} + +func (x *SessionInfo) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *SessionInfo) GetKeygenSessionId() string { + if x != nil { + return x.KeygenSessionId + } + return "" +} + +// PartyInfo contains party information +type PartyInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + PartyId string `protobuf:"bytes,1,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` + PartyIndex int32 `protobuf:"varint,2,opt,name=party_index,json=partyIndex,proto3" json:"party_index,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,3,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PartyInfo) Reset() { + *x = PartyInfo{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PartyInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartyInfo) ProtoMessage() {} + +func (x *PartyInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PartyInfo.ProtoReflect.Descriptor instead. +func (*PartyInfo) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{9} +} + +func (x *PartyInfo) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +func (x *PartyInfo) GetPartyIndex() int32 { + if x != nil { + return x.PartyIndex + } + return 0 +} + +func (x *PartyInfo) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +// GetSessionStatusRequest queries session status +type GetSessionStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSessionStatusRequest) Reset() { + *x = GetSessionStatusRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSessionStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSessionStatusRequest) ProtoMessage() {} + +func (x *GetSessionStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSessionStatusRequest.ProtoReflect.Descriptor instead. +func (*GetSessionStatusRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{10} +} + +func (x *GetSessionStatusRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +// GetSessionStatusResponse contains session status +type GetSessionStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + CompletedParties int32 `protobuf:"varint,2,opt,name=completed_parties,json=completedParties,proto3" json:"completed_parties,omitempty"` + TotalParties int32 `protobuf:"varint,3,opt,name=total_parties,json=totalParties,proto3" json:"total_parties,omitempty"` + SessionType string `protobuf:"bytes,4,opt,name=session_type,json=sessionType,proto3" json:"session_type,omitempty"` // "keygen" or "sign" + PublicKey []byte `protobuf:"bytes,5,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // For completed keygen + Signature []byte `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` // For completed sign + // has_delegate indicates whether this keygen session has a delegate party + // Only meaningful for keygen sessions. Always false for sign sessions. + HasDelegate bool `protobuf:"varint,7,opt,name=has_delegate,json=hasDelegate,proto3" json:"has_delegate,omitempty"` + // Delegate share info (returned when keygen session completed and delegate party submitted share) + // Only populated if session_type="keygen" AND has_delegate=true AND session is completed + DelegateShare *DelegateShareInfo `protobuf:"bytes,8,opt,name=delegate_share,json=delegateShare,proto3" json:"delegate_share,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSessionStatusResponse) Reset() { + *x = GetSessionStatusResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSessionStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSessionStatusResponse) ProtoMessage() {} + +func (x *GetSessionStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSessionStatusResponse.ProtoReflect.Descriptor instead. +func (*GetSessionStatusResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{11} +} + +func (x *GetSessionStatusResponse) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *GetSessionStatusResponse) GetCompletedParties() int32 { + if x != nil { + return x.CompletedParties + } + return 0 +} + +func (x *GetSessionStatusResponse) GetTotalParties() int32 { + if x != nil { + return x.TotalParties + } + return 0 +} + +func (x *GetSessionStatusResponse) GetSessionType() string { + if x != nil { + return x.SessionType + } + return "" +} + +func (x *GetSessionStatusResponse) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *GetSessionStatusResponse) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *GetSessionStatusResponse) GetHasDelegate() bool { + if x != nil { + return x.HasDelegate + } + return false +} + +func (x *GetSessionStatusResponse) GetDelegateShare() *DelegateShareInfo { + if x != nil { + return x.DelegateShare + } + return nil +} + +// DelegateShareInfo contains the delegate party's share for user +type DelegateShareInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + EncryptedShare []byte `protobuf:"bytes,1,opt,name=encrypted_share,json=encryptedShare,proto3" json:"encrypted_share,omitempty"` // Encrypted share for user + PartyIndex int32 `protobuf:"varint,2,opt,name=party_index,json=partyIndex,proto3" json:"party_index,omitempty"` // Party's index in the session + PartyId string `protobuf:"bytes,3,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` // Delegate party ID + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DelegateShareInfo) Reset() { + *x = DelegateShareInfo{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DelegateShareInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DelegateShareInfo) ProtoMessage() {} + +func (x *DelegateShareInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DelegateShareInfo.ProtoReflect.Descriptor instead. +func (*DelegateShareInfo) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{12} +} + +func (x *DelegateShareInfo) GetEncryptedShare() []byte { + if x != nil { + return x.EncryptedShare + } + return nil +} + +func (x *DelegateShareInfo) GetPartyIndex() int32 { + if x != nil { + return x.PartyIndex + } + return 0 +} + +func (x *DelegateShareInfo) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +// ReportCompletionRequest reports that a participant has completed +type ReportCompletionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + PartyId string `protobuf:"bytes,2,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` + PublicKey []byte `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // For keygen completion + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` // For sign completion + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportCompletionRequest) Reset() { + *x = ReportCompletionRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportCompletionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportCompletionRequest) ProtoMessage() {} + +func (x *ReportCompletionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportCompletionRequest.ProtoReflect.Descriptor instead. +func (*ReportCompletionRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{13} +} + +func (x *ReportCompletionRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *ReportCompletionRequest) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +func (x *ReportCompletionRequest) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *ReportCompletionRequest) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +// ReportCompletionResponse contains the result of completion report +type ReportCompletionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + AllCompleted bool `protobuf:"varint,2,opt,name=all_completed,json=allCompleted,proto3" json:"all_completed,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportCompletionResponse) Reset() { + *x = ReportCompletionResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportCompletionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportCompletionResponse) ProtoMessage() {} + +func (x *ReportCompletionResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportCompletionResponse.ProtoReflect.Descriptor instead. +func (*ReportCompletionResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{14} +} + +func (x *ReportCompletionResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReportCompletionResponse) GetAllCompleted() bool { + if x != nil { + return x.AllCompleted + } + return false +} + +// CloseSessionRequest closes a session +type CloseSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseSessionRequest) Reset() { + *x = CloseSessionRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseSessionRequest) ProtoMessage() {} + +func (x *CloseSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseSessionRequest.ProtoReflect.Descriptor instead. +func (*CloseSessionRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{15} +} + +func (x *CloseSessionRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +// CloseSessionResponse contains the result of session closure +type CloseSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CloseSessionResponse) Reset() { + *x = CloseSessionResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CloseSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseSessionResponse) ProtoMessage() {} + +func (x *CloseSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseSessionResponse.ProtoReflect.Descriptor instead. +func (*CloseSessionResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{16} +} + +func (x *CloseSessionResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +// MarkPartyReadyRequest marks a party as ready to start the protocol +type MarkPartyReadyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + PartyId string `protobuf:"bytes,2,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkPartyReadyRequest) Reset() { + *x = MarkPartyReadyRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkPartyReadyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkPartyReadyRequest) ProtoMessage() {} + +func (x *MarkPartyReadyRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkPartyReadyRequest.ProtoReflect.Descriptor instead. +func (*MarkPartyReadyRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{17} +} + +func (x *MarkPartyReadyRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *MarkPartyReadyRequest) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +// MarkPartyReadyResponse contains the result of marking party ready +type MarkPartyReadyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + AllReady bool `protobuf:"varint,2,opt,name=all_ready,json=allReady,proto3" json:"all_ready,omitempty"` // True if all parties are ready + ReadyCount int32 `protobuf:"varint,3,opt,name=ready_count,json=readyCount,proto3" json:"ready_count,omitempty"` + TotalParties int32 `protobuf:"varint,4,opt,name=total_parties,json=totalParties,proto3" json:"total_parties,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkPartyReadyResponse) Reset() { + *x = MarkPartyReadyResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkPartyReadyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkPartyReadyResponse) ProtoMessage() {} + +func (x *MarkPartyReadyResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkPartyReadyResponse.ProtoReflect.Descriptor instead. +func (*MarkPartyReadyResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{18} +} + +func (x *MarkPartyReadyResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *MarkPartyReadyResponse) GetAllReady() bool { + if x != nil { + return x.AllReady + } + return false +} + +func (x *MarkPartyReadyResponse) GetReadyCount() int32 { + if x != nil { + return x.ReadyCount + } + return 0 +} + +func (x *MarkPartyReadyResponse) GetTotalParties() int32 { + if x != nil { + return x.TotalParties + } + return 0 +} + +// StartSessionRequest starts the MPC protocol execution +type StartSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StartSessionRequest) Reset() { + *x = StartSessionRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StartSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartSessionRequest) ProtoMessage() {} + +func (x *StartSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartSessionRequest.ProtoReflect.Descriptor instead. +func (*StartSessionRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{19} +} + +func (x *StartSessionRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +// StartSessionResponse contains the result of starting the session +type StartSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // New session status + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StartSessionResponse) Reset() { + *x = StartSessionResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StartSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartSessionResponse) ProtoMessage() {} + +func (x *StartSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartSessionResponse.ProtoReflect.Descriptor instead. +func (*StartSessionResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{20} +} + +func (x *StartSessionResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *StartSessionResponse) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +// SubmitDelegateShareRequest submits user's share from delegate party +type SubmitDelegateShareRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + PartyId string `protobuf:"bytes,2,opt,name=party_id,json=partyId,proto3" json:"party_id,omitempty"` + EncryptedShare []byte `protobuf:"bytes,3,opt,name=encrypted_share,json=encryptedShare,proto3" json:"encrypted_share,omitempty"` // Encrypted share for user + PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Public key from keygen + PartyIndex int32 `protobuf:"varint,5,opt,name=party_index,json=partyIndex,proto3" json:"party_index,omitempty"` // Party's index in the session + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubmitDelegateShareRequest) Reset() { + *x = SubmitDelegateShareRequest{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubmitDelegateShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubmitDelegateShareRequest) ProtoMessage() {} + +func (x *SubmitDelegateShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubmitDelegateShareRequest.ProtoReflect.Descriptor instead. +func (*SubmitDelegateShareRequest) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{21} +} + +func (x *SubmitDelegateShareRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *SubmitDelegateShareRequest) GetPartyId() string { + if x != nil { + return x.PartyId + } + return "" +} + +func (x *SubmitDelegateShareRequest) GetEncryptedShare() []byte { + if x != nil { + return x.EncryptedShare + } + return nil +} + +func (x *SubmitDelegateShareRequest) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *SubmitDelegateShareRequest) GetPartyIndex() int32 { + if x != nil { + return x.PartyIndex + } + return 0 +} + +// SubmitDelegateShareResponse contains result of share submission +type SubmitDelegateShareResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubmitDelegateShareResponse) Reset() { + *x = SubmitDelegateShareResponse{} + mi := &file_api_proto_session_coordinator_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubmitDelegateShareResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubmitDelegateShareResponse) ProtoMessage() {} + +func (x *SubmitDelegateShareResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_session_coordinator_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubmitDelegateShareResponse.ProtoReflect.Descriptor instead. +func (*SubmitDelegateShareResponse) Descriptor() ([]byte, []int) { + return file_api_proto_session_coordinator_proto_rawDescGZIP(), []int{22} +} + +func (x *SubmitDelegateShareResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +var File_api_proto_session_coordinator_proto protoreflect.FileDescriptor + +const file_api_proto_session_coordinator_proto_rawDesc = "" + + "\n" + + "#api/proto/session_coordinator.proto\x12\x12mpc.coordinator.v1\"\xeb\x03\n" + + "\x14CreateSessionRequest\x12!\n" + + "\fsession_type\x18\x01 \x01(\tR\vsessionType\x12\x1f\n" + + "\vthreshold_n\x18\x02 \x01(\x05R\n" + + "thresholdN\x12\x1f\n" + + "\vthreshold_t\x18\x03 \x01(\x05R\n" + + "thresholdT\x12G\n" + + "\fparticipants\x18\x04 \x03(\v2#.mpc.coordinator.v1.ParticipantInfoR\fparticipants\x12!\n" + + "\fmessage_hash\x18\x05 \x01(\fR\vmessageHash\x12,\n" + + "\x12expires_in_seconds\x18\x06 \x01(\x03R\x10expiresInSeconds\x12Q\n" + + "\x11party_composition\x18\a \x01(\v2$.mpc.coordinator.v1.PartyCompositionR\x10partyComposition\x12U\n" + + "\x13delegate_user_share\x18\b \x01(\v2%.mpc.coordinator.v1.DelegateUserShareR\x11delegateUserShare\x12*\n" + + "\x11keygen_session_id\x18\t \x01(\tR\x0fkeygenSessionId\"\x89\x01\n" + + "\x11DelegateUserShare\x12*\n" + + "\x11delegate_party_id\x18\x01 \x01(\tR\x0fdelegatePartyId\x12'\n" + + "\x0fencrypted_share\x18\x02 \x01(\fR\x0eencryptedShare\x12\x1f\n" + + "\vparty_index\x18\x03 \x01(\x05R\n" + + "partyIndex\"\x8d\x01\n" + + "\x10PartyComposition\x12)\n" + + "\x10persistent_count\x18\x01 \x01(\x05R\x0fpersistentCount\x12%\n" + + "\x0edelegate_count\x18\x02 \x01(\x05R\rdelegateCount\x12'\n" + + "\x0ftemporary_count\x18\x03 \x01(\x05R\x0etemporaryCount\"m\n" + + "\x0fParticipantInfo\x12\x19\n" + + "\bparty_id\x18\x01 \x01(\tR\apartyId\x12?\n" + + "\vdevice_info\x18\x02 \x01(\v2\x1e.mpc.coordinator.v1.DeviceInfoR\n" + + "deviceInfo\"\x87\x01\n" + + "\n" + + "DeviceInfo\x12\x1f\n" + + "\vdevice_type\x18\x01 \x01(\tR\n" + + "deviceType\x12\x1b\n" + + "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12\x1a\n" + + "\bplatform\x18\x03 \x01(\tR\bplatform\x12\x1f\n" + + "\vapp_version\x18\x04 \x01(\tR\n" + + "appVersion\"\xc7\x02\n" + + "\x15CreateSessionResponse\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\x12Z\n" + + "\vjoin_tokens\x18\x02 \x03(\v29.mpc.coordinator.v1.CreateSessionResponse.JoinTokensEntryR\n" + + "joinTokens\x12\x1d\n" + + "\n" + + "expires_at\x18\x03 \x01(\x03R\texpiresAt\x12)\n" + + "\x10selected_parties\x18\x04 \x03(\tR\x0fselectedParties\x12*\n" + + "\x11delegate_party_id\x18\x05 \x01(\tR\x0fdelegatePartyId\x1a=\n" + + "\x0fJoinTokensEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xae\x01\n" + + "\x12JoinSessionRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\x12\x19\n" + + "\bparty_id\x18\x02 \x01(\tR\apartyId\x12\x1d\n" + + "\n" + + "join_token\x18\x03 \x01(\tR\tjoinToken\x12?\n" + + "\vdevice_info\x18\x04 \x01(\v2\x1e.mpc.coordinator.v1.DeviceInfoR\n" + + "deviceInfo\"\xd8\x01\n" + + "\x13JoinSessionResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12B\n" + + "\fsession_info\x18\x02 \x01(\v2\x1f.mpc.coordinator.v1.SessionInfoR\vsessionInfo\x12B\n" + + "\rother_parties\x18\x03 \x03(\v2\x1d.mpc.coordinator.v1.PartyInfoR\fotherParties\x12\x1f\n" + + "\vparty_index\x18\x04 \x01(\x05R\n" + + "partyIndex\"\xf8\x01\n" + + "\vSessionInfo\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\x12!\n" + + "\fsession_type\x18\x02 \x01(\tR\vsessionType\x12\x1f\n" + + "\vthreshold_n\x18\x03 \x01(\x05R\n" + + "thresholdN\x12\x1f\n" + + "\vthreshold_t\x18\x04 \x01(\x05R\n" + + "thresholdT\x12!\n" + + "\fmessage_hash\x18\x05 \x01(\fR\vmessageHash\x12\x16\n" + + "\x06status\x18\x06 \x01(\tR\x06status\x12*\n" + + "\x11keygen_session_id\x18\a \x01(\tR\x0fkeygenSessionId\"\x88\x01\n" + + "\tPartyInfo\x12\x19\n" + + "\bparty_id\x18\x01 \x01(\tR\apartyId\x12\x1f\n" + + "\vparty_index\x18\x02 \x01(\x05R\n" + + "partyIndex\x12?\n" + + "\vdevice_info\x18\x03 \x01(\v2\x1e.mpc.coordinator.v1.DeviceInfoR\n" + + "deviceInfo\"8\n" + + "\x17GetSessionStatusRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\"\xd5\x02\n" + + "\x18GetSessionStatusResponse\x12\x16\n" + + "\x06status\x18\x01 \x01(\tR\x06status\x12+\n" + + "\x11completed_parties\x18\x02 \x01(\x05R\x10completedParties\x12#\n" + + "\rtotal_parties\x18\x03 \x01(\x05R\ftotalParties\x12!\n" + + "\fsession_type\x18\x04 \x01(\tR\vsessionType\x12\x1d\n" + + "\n" + + "public_key\x18\x05 \x01(\fR\tpublicKey\x12\x1c\n" + + "\tsignature\x18\x06 \x01(\fR\tsignature\x12!\n" + + "\fhas_delegate\x18\a \x01(\bR\vhasDelegate\x12L\n" + + "\x0edelegate_share\x18\b \x01(\v2%.mpc.coordinator.v1.DelegateShareInfoR\rdelegateShare\"x\n" + + "\x11DelegateShareInfo\x12'\n" + + "\x0fencrypted_share\x18\x01 \x01(\fR\x0eencryptedShare\x12\x1f\n" + + "\vparty_index\x18\x02 \x01(\x05R\n" + + "partyIndex\x12\x19\n" + + "\bparty_id\x18\x03 \x01(\tR\apartyId\"\x90\x01\n" + + "\x17ReportCompletionRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\x12\x19\n" + + "\bparty_id\x18\x02 \x01(\tR\apartyId\x12\x1d\n" + + "\n" + + "public_key\x18\x03 \x01(\fR\tpublicKey\x12\x1c\n" + + "\tsignature\x18\x04 \x01(\fR\tsignature\"Y\n" + + "\x18ReportCompletionResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" + + "\rall_completed\x18\x02 \x01(\bR\fallCompleted\"4\n" + + "\x13CloseSessionRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\"0\n" + + "\x14CloseSessionResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\"Q\n" + + "\x15MarkPartyReadyRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\x12\x19\n" + + "\bparty_id\x18\x02 \x01(\tR\apartyId\"\x95\x01\n" + + "\x16MarkPartyReadyResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1b\n" + + "\tall_ready\x18\x02 \x01(\bR\ballReady\x12\x1f\n" + + "\vready_count\x18\x03 \x01(\x05R\n" + + "readyCount\x12#\n" + + "\rtotal_parties\x18\x04 \x01(\x05R\ftotalParties\"4\n" + + "\x13StartSessionRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\"H\n" + + "\x14StartSessionResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x16\n" + + "\x06status\x18\x02 \x01(\tR\x06status\"\xbf\x01\n" + + "\x1aSubmitDelegateShareRequest\x12\x1d\n" + + "\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\x12\x19\n" + + "\bparty_id\x18\x02 \x01(\tR\apartyId\x12'\n" + + "\x0fencrypted_share\x18\x03 \x01(\fR\x0eencryptedShare\x12\x1d\n" + + "\n" + + "public_key\x18\x04 \x01(\fR\tpublicKey\x12\x1f\n" + + "\vparty_index\x18\x05 \x01(\x05R\n" + + "partyIndex\"7\n" + + "\x1bSubmitDelegateShareResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess2\xdf\x06\n" + + "\x12SessionCoordinator\x12d\n" + + "\rCreateSession\x12(.mpc.coordinator.v1.CreateSessionRequest\x1a).mpc.coordinator.v1.CreateSessionResponse\x12^\n" + + "\vJoinSession\x12&.mpc.coordinator.v1.JoinSessionRequest\x1a'.mpc.coordinator.v1.JoinSessionResponse\x12m\n" + + "\x10GetSessionStatus\x12+.mpc.coordinator.v1.GetSessionStatusRequest\x1a,.mpc.coordinator.v1.GetSessionStatusResponse\x12g\n" + + "\x0eMarkPartyReady\x12).mpc.coordinator.v1.MarkPartyReadyRequest\x1a*.mpc.coordinator.v1.MarkPartyReadyResponse\x12a\n" + + "\fStartSession\x12'.mpc.coordinator.v1.StartSessionRequest\x1a(.mpc.coordinator.v1.StartSessionResponse\x12m\n" + + "\x10ReportCompletion\x12+.mpc.coordinator.v1.ReportCompletionRequest\x1a,.mpc.coordinator.v1.ReportCompletionResponse\x12a\n" + + "\fCloseSession\x12'.mpc.coordinator.v1.CloseSessionRequest\x1a(.mpc.coordinator.v1.CloseSessionResponse\x12v\n" + + "\x13SubmitDelegateShare\x12..mpc.coordinator.v1.SubmitDelegateShareRequest\x1a/.mpc.coordinator.v1.SubmitDelegateShareResponseBEZCgithub.com/rwadurian/mpc-system/api/grpc/coordinator/v1;coordinatorb\x06proto3" + +var ( + file_api_proto_session_coordinator_proto_rawDescOnce sync.Once + file_api_proto_session_coordinator_proto_rawDescData []byte +) + +func file_api_proto_session_coordinator_proto_rawDescGZIP() []byte { + file_api_proto_session_coordinator_proto_rawDescOnce.Do(func() { + file_api_proto_session_coordinator_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_proto_session_coordinator_proto_rawDesc), len(file_api_proto_session_coordinator_proto_rawDesc))) + }) + return file_api_proto_session_coordinator_proto_rawDescData +} + +var file_api_proto_session_coordinator_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_api_proto_session_coordinator_proto_goTypes = []any{ + (*CreateSessionRequest)(nil), // 0: mpc.coordinator.v1.CreateSessionRequest + (*DelegateUserShare)(nil), // 1: mpc.coordinator.v1.DelegateUserShare + (*PartyComposition)(nil), // 2: mpc.coordinator.v1.PartyComposition + (*ParticipantInfo)(nil), // 3: mpc.coordinator.v1.ParticipantInfo + (*DeviceInfo)(nil), // 4: mpc.coordinator.v1.DeviceInfo + (*CreateSessionResponse)(nil), // 5: mpc.coordinator.v1.CreateSessionResponse + (*JoinSessionRequest)(nil), // 6: mpc.coordinator.v1.JoinSessionRequest + (*JoinSessionResponse)(nil), // 7: mpc.coordinator.v1.JoinSessionResponse + (*SessionInfo)(nil), // 8: mpc.coordinator.v1.SessionInfo + (*PartyInfo)(nil), // 9: mpc.coordinator.v1.PartyInfo + (*GetSessionStatusRequest)(nil), // 10: mpc.coordinator.v1.GetSessionStatusRequest + (*GetSessionStatusResponse)(nil), // 11: mpc.coordinator.v1.GetSessionStatusResponse + (*DelegateShareInfo)(nil), // 12: mpc.coordinator.v1.DelegateShareInfo + (*ReportCompletionRequest)(nil), // 13: mpc.coordinator.v1.ReportCompletionRequest + (*ReportCompletionResponse)(nil), // 14: mpc.coordinator.v1.ReportCompletionResponse + (*CloseSessionRequest)(nil), // 15: mpc.coordinator.v1.CloseSessionRequest + (*CloseSessionResponse)(nil), // 16: mpc.coordinator.v1.CloseSessionResponse + (*MarkPartyReadyRequest)(nil), // 17: mpc.coordinator.v1.MarkPartyReadyRequest + (*MarkPartyReadyResponse)(nil), // 18: mpc.coordinator.v1.MarkPartyReadyResponse + (*StartSessionRequest)(nil), // 19: mpc.coordinator.v1.StartSessionRequest + (*StartSessionResponse)(nil), // 20: mpc.coordinator.v1.StartSessionResponse + (*SubmitDelegateShareRequest)(nil), // 21: mpc.coordinator.v1.SubmitDelegateShareRequest + (*SubmitDelegateShareResponse)(nil), // 22: mpc.coordinator.v1.SubmitDelegateShareResponse + nil, // 23: mpc.coordinator.v1.CreateSessionResponse.JoinTokensEntry +} +var file_api_proto_session_coordinator_proto_depIdxs = []int32{ + 3, // 0: mpc.coordinator.v1.CreateSessionRequest.participants:type_name -> mpc.coordinator.v1.ParticipantInfo + 2, // 1: mpc.coordinator.v1.CreateSessionRequest.party_composition:type_name -> mpc.coordinator.v1.PartyComposition + 1, // 2: mpc.coordinator.v1.CreateSessionRequest.delegate_user_share:type_name -> mpc.coordinator.v1.DelegateUserShare + 4, // 3: mpc.coordinator.v1.ParticipantInfo.device_info:type_name -> mpc.coordinator.v1.DeviceInfo + 23, // 4: mpc.coordinator.v1.CreateSessionResponse.join_tokens:type_name -> mpc.coordinator.v1.CreateSessionResponse.JoinTokensEntry + 4, // 5: mpc.coordinator.v1.JoinSessionRequest.device_info:type_name -> mpc.coordinator.v1.DeviceInfo + 8, // 6: mpc.coordinator.v1.JoinSessionResponse.session_info:type_name -> mpc.coordinator.v1.SessionInfo + 9, // 7: mpc.coordinator.v1.JoinSessionResponse.other_parties:type_name -> mpc.coordinator.v1.PartyInfo + 4, // 8: mpc.coordinator.v1.PartyInfo.device_info:type_name -> mpc.coordinator.v1.DeviceInfo + 12, // 9: mpc.coordinator.v1.GetSessionStatusResponse.delegate_share:type_name -> mpc.coordinator.v1.DelegateShareInfo + 0, // 10: mpc.coordinator.v1.SessionCoordinator.CreateSession:input_type -> mpc.coordinator.v1.CreateSessionRequest + 6, // 11: mpc.coordinator.v1.SessionCoordinator.JoinSession:input_type -> mpc.coordinator.v1.JoinSessionRequest + 10, // 12: mpc.coordinator.v1.SessionCoordinator.GetSessionStatus:input_type -> mpc.coordinator.v1.GetSessionStatusRequest + 17, // 13: mpc.coordinator.v1.SessionCoordinator.MarkPartyReady:input_type -> mpc.coordinator.v1.MarkPartyReadyRequest + 19, // 14: mpc.coordinator.v1.SessionCoordinator.StartSession:input_type -> mpc.coordinator.v1.StartSessionRequest + 13, // 15: mpc.coordinator.v1.SessionCoordinator.ReportCompletion:input_type -> mpc.coordinator.v1.ReportCompletionRequest + 15, // 16: mpc.coordinator.v1.SessionCoordinator.CloseSession:input_type -> mpc.coordinator.v1.CloseSessionRequest + 21, // 17: mpc.coordinator.v1.SessionCoordinator.SubmitDelegateShare:input_type -> mpc.coordinator.v1.SubmitDelegateShareRequest + 5, // 18: mpc.coordinator.v1.SessionCoordinator.CreateSession:output_type -> mpc.coordinator.v1.CreateSessionResponse + 7, // 19: mpc.coordinator.v1.SessionCoordinator.JoinSession:output_type -> mpc.coordinator.v1.JoinSessionResponse + 11, // 20: mpc.coordinator.v1.SessionCoordinator.GetSessionStatus:output_type -> mpc.coordinator.v1.GetSessionStatusResponse + 18, // 21: mpc.coordinator.v1.SessionCoordinator.MarkPartyReady:output_type -> mpc.coordinator.v1.MarkPartyReadyResponse + 20, // 22: mpc.coordinator.v1.SessionCoordinator.StartSession:output_type -> mpc.coordinator.v1.StartSessionResponse + 14, // 23: mpc.coordinator.v1.SessionCoordinator.ReportCompletion:output_type -> mpc.coordinator.v1.ReportCompletionResponse + 16, // 24: mpc.coordinator.v1.SessionCoordinator.CloseSession:output_type -> mpc.coordinator.v1.CloseSessionResponse + 22, // 25: mpc.coordinator.v1.SessionCoordinator.SubmitDelegateShare:output_type -> mpc.coordinator.v1.SubmitDelegateShareResponse + 18, // [18:26] is the sub-list for method output_type + 10, // [10:18] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_api_proto_session_coordinator_proto_init() } +func file_api_proto_session_coordinator_proto_init() { + if File_api_proto_session_coordinator_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_proto_session_coordinator_proto_rawDesc), len(file_api_proto_session_coordinator_proto_rawDesc)), + NumEnums: 0, + NumMessages: 24, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_proto_session_coordinator_proto_goTypes, + DependencyIndexes: file_api_proto_session_coordinator_proto_depIdxs, + MessageInfos: file_api_proto_session_coordinator_proto_msgTypes, + }.Build() + File_api_proto_session_coordinator_proto = out.File + file_api_proto_session_coordinator_proto_goTypes = nil + file_api_proto_session_coordinator_proto_depIdxs = nil +} diff --git a/backend/mpc-system/api/proto/session_coordinator.proto b/backend/mpc-system/api/proto/session_coordinator.proto index 506c41df..55326a5b 100644 --- a/backend/mpc-system/api/proto/session_coordinator.proto +++ b/backend/mpc-system/api/proto/session_coordinator.proto @@ -30,6 +30,8 @@ message CreateSessionRequest { PartyComposition party_composition = 7; // Optional: party composition requirements for auto-selection // For sign sessions with delegate party: user must provide their encrypted share DelegateUserShare delegate_user_share = 8; + // For sign sessions: which keygen session's shares to use + string keygen_session_id = 9; } // DelegateUserShare contains user's share for delegate party to use in signing @@ -93,6 +95,8 @@ message SessionInfo { int32 threshold_t = 4; bytes message_hash = 5; string status = 6; + // For sign sessions: which keygen session's shares to use + string keygen_session_id = 7; } // PartyInfo contains party information diff --git a/backend/mpc-system/api/proto/session_coordinator_grpc.pb.go b/backend/mpc-system/api/proto/session_coordinator_grpc.pb.go new file mode 100644 index 00000000..ec50e1d7 --- /dev/null +++ b/backend/mpc-system/api/proto/session_coordinator_grpc.pb.go @@ -0,0 +1,395 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.0 +// - protoc v6.33.1 +// source: api/proto/session_coordinator.proto + +package coordinator + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SessionCoordinator_CreateSession_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/CreateSession" + SessionCoordinator_JoinSession_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/JoinSession" + SessionCoordinator_GetSessionStatus_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/GetSessionStatus" + SessionCoordinator_MarkPartyReady_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/MarkPartyReady" + SessionCoordinator_StartSession_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/StartSession" + SessionCoordinator_ReportCompletion_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/ReportCompletion" + SessionCoordinator_CloseSession_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/CloseSession" + SessionCoordinator_SubmitDelegateShare_FullMethodName = "/mpc.coordinator.v1.SessionCoordinator/SubmitDelegateShare" +) + +// SessionCoordinatorClient is the client API for SessionCoordinator service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// SessionCoordinator service manages MPC sessions +type SessionCoordinatorClient interface { + // Session management + CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error) + JoinSession(ctx context.Context, in *JoinSessionRequest, opts ...grpc.CallOption) (*JoinSessionResponse, error) + GetSessionStatus(ctx context.Context, in *GetSessionStatusRequest, opts ...grpc.CallOption) (*GetSessionStatusResponse, error) + MarkPartyReady(ctx context.Context, in *MarkPartyReadyRequest, opts ...grpc.CallOption) (*MarkPartyReadyResponse, error) + StartSession(ctx context.Context, in *StartSessionRequest, opts ...grpc.CallOption) (*StartSessionResponse, error) + ReportCompletion(ctx context.Context, in *ReportCompletionRequest, opts ...grpc.CallOption) (*ReportCompletionResponse, error) + CloseSession(ctx context.Context, in *CloseSessionRequest, opts ...grpc.CallOption) (*CloseSessionResponse, error) + // Delegate party share submission (delegate party submits user's share after keygen) + SubmitDelegateShare(ctx context.Context, in *SubmitDelegateShareRequest, opts ...grpc.CallOption) (*SubmitDelegateShareResponse, error) +} + +type sessionCoordinatorClient struct { + cc grpc.ClientConnInterface +} + +func NewSessionCoordinatorClient(cc grpc.ClientConnInterface) SessionCoordinatorClient { + return &sessionCoordinatorClient{cc} +} + +func (c *sessionCoordinatorClient) CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateSessionResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_CreateSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) JoinSession(ctx context.Context, in *JoinSessionRequest, opts ...grpc.CallOption) (*JoinSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(JoinSessionResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_JoinSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) GetSessionStatus(ctx context.Context, in *GetSessionStatusRequest, opts ...grpc.CallOption) (*GetSessionStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetSessionStatusResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_GetSessionStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) MarkPartyReady(ctx context.Context, in *MarkPartyReadyRequest, opts ...grpc.CallOption) (*MarkPartyReadyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MarkPartyReadyResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_MarkPartyReady_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) StartSession(ctx context.Context, in *StartSessionRequest, opts ...grpc.CallOption) (*StartSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StartSessionResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_StartSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) ReportCompletion(ctx context.Context, in *ReportCompletionRequest, opts ...grpc.CallOption) (*ReportCompletionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReportCompletionResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_ReportCompletion_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) CloseSession(ctx context.Context, in *CloseSessionRequest, opts ...grpc.CallOption) (*CloseSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CloseSessionResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_CloseSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionCoordinatorClient) SubmitDelegateShare(ctx context.Context, in *SubmitDelegateShareRequest, opts ...grpc.CallOption) (*SubmitDelegateShareResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SubmitDelegateShareResponse) + err := c.cc.Invoke(ctx, SessionCoordinator_SubmitDelegateShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SessionCoordinatorServer is the server API for SessionCoordinator service. +// All implementations must embed UnimplementedSessionCoordinatorServer +// for forward compatibility. +// +// SessionCoordinator service manages MPC sessions +type SessionCoordinatorServer interface { + // Session management + CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error) + JoinSession(context.Context, *JoinSessionRequest) (*JoinSessionResponse, error) + GetSessionStatus(context.Context, *GetSessionStatusRequest) (*GetSessionStatusResponse, error) + MarkPartyReady(context.Context, *MarkPartyReadyRequest) (*MarkPartyReadyResponse, error) + StartSession(context.Context, *StartSessionRequest) (*StartSessionResponse, error) + ReportCompletion(context.Context, *ReportCompletionRequest) (*ReportCompletionResponse, error) + CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error) + // Delegate party share submission (delegate party submits user's share after keygen) + SubmitDelegateShare(context.Context, *SubmitDelegateShareRequest) (*SubmitDelegateShareResponse, error) + mustEmbedUnimplementedSessionCoordinatorServer() +} + +// UnimplementedSessionCoordinatorServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSessionCoordinatorServer struct{} + +func (UnimplementedSessionCoordinatorServer) CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateSession not implemented") +} +func (UnimplementedSessionCoordinatorServer) JoinSession(context.Context, *JoinSessionRequest) (*JoinSessionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method JoinSession not implemented") +} +func (UnimplementedSessionCoordinatorServer) GetSessionStatus(context.Context, *GetSessionStatusRequest) (*GetSessionStatusResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetSessionStatus not implemented") +} +func (UnimplementedSessionCoordinatorServer) MarkPartyReady(context.Context, *MarkPartyReadyRequest) (*MarkPartyReadyResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MarkPartyReady not implemented") +} +func (UnimplementedSessionCoordinatorServer) StartSession(context.Context, *StartSessionRequest) (*StartSessionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method StartSession not implemented") +} +func (UnimplementedSessionCoordinatorServer) ReportCompletion(context.Context, *ReportCompletionRequest) (*ReportCompletionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReportCompletion not implemented") +} +func (UnimplementedSessionCoordinatorServer) CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CloseSession not implemented") +} +func (UnimplementedSessionCoordinatorServer) SubmitDelegateShare(context.Context, *SubmitDelegateShareRequest) (*SubmitDelegateShareResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SubmitDelegateShare not implemented") +} +func (UnimplementedSessionCoordinatorServer) mustEmbedUnimplementedSessionCoordinatorServer() {} +func (UnimplementedSessionCoordinatorServer) testEmbeddedByValue() {} + +// UnsafeSessionCoordinatorServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SessionCoordinatorServer will +// result in compilation errors. +type UnsafeSessionCoordinatorServer interface { + mustEmbedUnimplementedSessionCoordinatorServer() +} + +func RegisterSessionCoordinatorServer(s grpc.ServiceRegistrar, srv SessionCoordinatorServer) { + // If the following call panics, it indicates UnimplementedSessionCoordinatorServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SessionCoordinator_ServiceDesc, srv) +} + +func _SessionCoordinator_CreateSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).CreateSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_CreateSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).CreateSession(ctx, req.(*CreateSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_JoinSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(JoinSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).JoinSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_JoinSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).JoinSession(ctx, req.(*JoinSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_GetSessionStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSessionStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).GetSessionStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_GetSessionStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).GetSessionStatus(ctx, req.(*GetSessionStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_MarkPartyReady_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarkPartyReadyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).MarkPartyReady(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_MarkPartyReady_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).MarkPartyReady(ctx, req.(*MarkPartyReadyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_StartSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).StartSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_StartSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).StartSession(ctx, req.(*StartSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_ReportCompletion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReportCompletionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).ReportCompletion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_ReportCompletion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).ReportCompletion(ctx, req.(*ReportCompletionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_CloseSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).CloseSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_CloseSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).CloseSession(ctx, req.(*CloseSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionCoordinator_SubmitDelegateShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubmitDelegateShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionCoordinatorServer).SubmitDelegateShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionCoordinator_SubmitDelegateShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionCoordinatorServer).SubmitDelegateShare(ctx, req.(*SubmitDelegateShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SessionCoordinator_ServiceDesc is the grpc.ServiceDesc for SessionCoordinator service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SessionCoordinator_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "mpc.coordinator.v1.SessionCoordinator", + HandlerType: (*SessionCoordinatorServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateSession", + Handler: _SessionCoordinator_CreateSession_Handler, + }, + { + MethodName: "JoinSession", + Handler: _SessionCoordinator_JoinSession_Handler, + }, + { + MethodName: "GetSessionStatus", + Handler: _SessionCoordinator_GetSessionStatus_Handler, + }, + { + MethodName: "MarkPartyReady", + Handler: _SessionCoordinator_MarkPartyReady_Handler, + }, + { + MethodName: "StartSession", + Handler: _SessionCoordinator_StartSession_Handler, + }, + { + MethodName: "ReportCompletion", + Handler: _SessionCoordinator_ReportCompletion_Handler, + }, + { + MethodName: "CloseSession", + Handler: _SessionCoordinator_CloseSession_Handler, + }, + { + MethodName: "SubmitDelegateShare", + Handler: _SessionCoordinator_SubmitDelegateShare_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/proto/session_coordinator.proto", +} diff --git a/backend/mpc-system/services/account/adapters/input/http/account_handler.go b/backend/mpc-system/services/account/adapters/input/http/account_handler.go index 8b0f9ce6..b389f723 100644 --- a/backend/mpc-system/services/account/adapters/input/http/account_handler.go +++ b/backend/mpc-system/services/account/adapters/input/http/account_handler.go @@ -824,6 +824,7 @@ func (h *AccountHTTPHandler) CreateSigningSession(c *gin.Context) { messageHash, 600, // 10 minutes expiry delegateUserShare, + accountOutput.Account.KeygenSessionID.String(), ) if err != nil { diff --git a/backend/mpc-system/services/account/adapters/output/grpc/session_coordinator_client.go b/backend/mpc-system/services/account/adapters/output/grpc/session_coordinator_client.go index b5c41688..189a6d48 100644 --- a/backend/mpc-system/services/account/adapters/output/grpc/session_coordinator_client.go +++ b/backend/mpc-system/services/account/adapters/output/grpc/session_coordinator_client.go @@ -138,6 +138,7 @@ func (c *SessionCoordinatorClient) CreateSigningSessionAuto( messageHash []byte, expiresInSeconds int64, delegateUserShare *DelegateUserShareInput, + keygenSessionID string, ) (*CreateSessionAutoResponse, error) { // Convert party IDs to participant info (minimal info, coordinator will fill in details) pbParticipants := make([]*coordinatorpb.ParticipantInfo, len(partyIDs)) @@ -154,6 +155,7 @@ func (c *SessionCoordinatorClient) CreateSigningSessionAuto( Participants: pbParticipants, MessageHash: messageHash, ExpiresInSeconds: expiresInSeconds, + KeygenSessionId: keygenSessionID, } // Add delegate user share if provided diff --git a/backend/mpc-system/services/server-party/application/use_cases/participate_keygen.go b/backend/mpc-system/services/server-party/application/use_cases/participate_keygen.go index 82b4f763..ba4a9ec0 100644 --- a/backend/mpc-system/services/server-party/application/use_cases/participate_keygen.go +++ b/backend/mpc-system/services/server-party/application/use_cases/participate_keygen.go @@ -51,12 +51,13 @@ type MessageRouterClient interface { // SessionInfo contains session information from coordinator type SessionInfo struct { - SessionID uuid.UUID - SessionType string - ThresholdN int - ThresholdT int - MessageHash []byte - Participants []ParticipantInfo + SessionID uuid.UUID + SessionType string + ThresholdN int + ThresholdT int + MessageHash []byte + KeygenSessionID uuid.UUID // For signing sessions: which keygen session's share to use + Participants []ParticipantInfo } // ParticipantInfo contains participant information diff --git a/backend/mpc-system/services/server-party/application/use_cases/participate_signing.go b/backend/mpc-system/services/server-party/application/use_cases/participate_signing.go index 71c7f4eb..da81862d 100644 --- a/backend/mpc-system/services/server-party/application/use_cases/participate_signing.go +++ b/backend/mpc-system/services/server-party/application/use_cases/participate_signing.go @@ -96,14 +96,34 @@ func (uc *ParticipateSigningUseCase) Execute( zap.String("session_id", input.SessionID.String())) } else { // Persistent party: load from database - keyShares, err := uc.keyShareRepo.ListByParty(ctx, input.PartyID) - if err != nil || len(keyShares) == 0 { - return nil, ErrKeyShareNotFound + // If KeygenSessionID is provided, use it to load the specific share + // Otherwise, use the most recent share (fallback for backward compatibility) + if sessionInfo.KeygenSessionID != uuid.Nil { + // Load the specific share for this keygen session + keyShareForUpdate, err = uc.keyShareRepo.FindBySessionAndParty(ctx, sessionInfo.KeygenSessionID, input.PartyID) + if err != nil { + logger.Error("Failed to find keyshare for keygen session", + zap.String("party_id", input.PartyID), + zap.String("keygen_session_id", sessionInfo.KeygenSessionID.String()), + zap.Error(err)) + return nil, ErrKeyShareNotFound + } + logger.Info("Using specific keyshare by keygen_session_id", + zap.String("party_id", input.PartyID), + zap.String("keygen_session_id", sessionInfo.KeygenSessionID.String())) + } else { + // Fallback: use the most recent key share + // TODO: This should be removed once all signing sessions provide keygen_session_id + keyShares, err := uc.keyShareRepo.ListByParty(ctx, input.PartyID) + if err != nil || len(keyShares) == 0 { + return nil, ErrKeyShareNotFound + } + keyShareForUpdate = keyShares[len(keyShares)-1] + logger.Warn("Using most recent keyshare (keygen_session_id not provided)", + zap.String("party_id", input.PartyID), + zap.String("fallback_session_id", keyShareForUpdate.SessionID.String())) } - // Use the most recent key share (in production, would match by public key or session reference) - keyShareForUpdate = keyShares[len(keyShares)-1] - // Get original threshold_n from keygen originalThresholdN = keyShareForUpdate.ThresholdN @@ -115,6 +135,7 @@ func (uc *ParticipateSigningUseCase) Execute( logger.Info("Using database share (persistent party)", zap.String("party_id", input.PartyID), zap.String("session_id", input.SessionID.String()), + zap.String("keygen_session_id", keyShareForUpdate.SessionID.String()), zap.Int("original_threshold_n", originalThresholdN), zap.Int("threshold_t", keyShareForUpdate.ThresholdT)) } @@ -276,19 +297,35 @@ func (h *signingMessageHandler) ReceiveMessages() <-chan *tss.ReceivedMessage { } func (h *signingMessageHandler) convertMessages(ctx context.Context, inChan <-chan *MPCMessage) { + logger.Debug("convertMessages started, waiting for messages", + zap.String("session_id", h.sessionID.String()), + zap.String("party_id", h.partyID)) + for { select { case <-ctx.Done(): + logger.Debug("convertMessages context cancelled", zap.String("session_id", h.sessionID.String())) close(h.msgChan) return case msg, ok := <-inChan: if !ok { + logger.Debug("convertMessages inChan closed", zap.String("session_id", h.sessionID.String())) close(h.msgChan) return } + logger.Debug("Received MPC message for conversion", + zap.String("session_id", h.sessionID.String()), + zap.String("from_party", msg.FromParty), + zap.Bool("is_broadcast", msg.IsBroadcast), + zap.Int("payload_size", len(msg.Payload))) + fromIndex, exists := h.partyIndexMap[msg.FromParty] if !exists { + logger.Warn("Message from unknown party - dropping", + zap.String("session_id", h.sessionID.String()), + zap.String("from_party", msg.FromParty), + zap.Any("known_parties", h.partyIndexMap)) continue } @@ -298,8 +335,15 @@ func (h *signingMessageHandler) convertMessages(ctx context.Context, inChan <-ch MsgBytes: msg.Payload, } + logger.Debug("Converted message, sending to TSS", + zap.String("session_id", h.sessionID.String()), + zap.String("from_party", msg.FromParty), + zap.Int("from_index", fromIndex)) + select { case h.msgChan <- tssMsg: + logger.Debug("Message sent to TSS successfully", + zap.String("session_id", h.sessionID.String())) case <-ctx.Done(): return } diff --git a/backend/mpc-system/test_create_session.go b/backend/mpc-system/test_create_session.go index 8e46eb30..60e32510 100644 --- a/backend/mpc-system/test_create_session.go +++ b/backend/mpc-system/test_create_session.go @@ -55,12 +55,13 @@ func main() { fmt.Printf("Generated JWT token: %s\n\n", token) - // Create keygen session via account-service + // Create keygen session via account-service (without delegate) + // For true 2-of-3: threshold_t=1 means t+1=2 signers required out of 3 total sessionData := map[string]interface{}{ "threshold_n": 3, - "threshold_t": 2, + "threshold_t": 1, "username": "admin", - "require_delegate": true, + "require_delegate": false, } jsonData, err := json.Marshal(sessionData) diff --git a/backend/mpc-system/test_signing.go b/backend/mpc-system/test_signing.go index 8433c091..85edad85 100644 --- a/backend/mpc-system/test_signing.go +++ b/backend/mpc-system/test_signing.go @@ -66,8 +66,9 @@ func main() { fmt.Printf("Message Hash (SHA-256): %s\n\n", messageHashHex) // Create signing session via account-service + // This account has threshold_t=1, so should only need 2 parties (t+1=2) signingData := map[string]interface{}{ - "username": "admin", + "username": "wallet-76e34337", "message_hash": messageHashHex, }