From 54555b47de389875b22459e77da1963c7ce9d0d4 Mon Sep 17 00:00:00 2001 From: Mykhailo Prakhov Date: Fri, 19 Jul 2024 12:34:34 +0200 Subject: [PATCH] fix(logs)_: remove community private key logging in publishCommunityPrivilegedMemberSyncMessage --- .../communnity_privileged_member_sync_msg.go | 1 - protocol/communities/manager.go | 11 +++-------- protocol/messenger_communities.go | 9 +++++++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/protocol/communities/communnity_privileged_member_sync_msg.go b/protocol/communities/communnity_privileged_member_sync_msg.go index 58e7cff82..f1b4600ee 100644 --- a/protocol/communities/communnity_privileged_member_sync_msg.go +++ b/protocol/communities/communnity_privileged_member_sync_msg.go @@ -18,7 +18,6 @@ var ErrOutdatedSharedRequestToJoinClock = errors.New("outdated clock in shared r var ErrOutdatedSharedRequestToJoinState = errors.New("outdated state in shared request to join") type CommunityPrivilegedMemberSyncMessage struct { - CommunityPrivateKey *ecdsa.PrivateKey Receivers []*ecdsa.PublicKey CommunityPrivilegedUserSyncMessage *protobuf.CommunityPrivilegedUserSyncMessage } diff --git a/protocol/communities/manager.go b/protocol/communities/manager.go index 06582a2f0..2f63c0b1f 100644 --- a/protocol/communities/manager.go +++ b/protocol/communities/manager.go @@ -3190,8 +3190,7 @@ func (m *Manager) HandleCommunityEditSharedAddresses(signer *ecdsa.PublicKey, re } subscriptionMsg := &CommunityPrivilegedMemberSyncMessage{ - CommunityPrivateKey: community.PrivateKey(), - Receivers: community.GetTokenMasterMembers(), + Receivers: community.GetTokenMasterMembers(), CommunityPrivilegedUserSyncMessage: &protobuf.CommunityPrivilegedUserSyncMessage{ Type: protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_MEMBER_EDIT_SHARED_ADDRESSES, CommunityId: community.ID(), @@ -4863,9 +4862,7 @@ func (m *Manager) ShareRequestsToJoinWithPrivilegedMembers(community *Community, SyncRequestsToJoin: syncRequestsWithRevealedAccounts, } - subscriptionMsg := &CommunityPrivilegedMemberSyncMessage{ - CommunityPrivateKey: community.PrivateKey(), - } + subscriptionMsg := &CommunityPrivilegedMemberSyncMessage{} for role, members := range privilegedMembers { if len(members) == 0 { @@ -4919,9 +4916,7 @@ func (m *Manager) shareAcceptedRequestToJoinWithPrivilegedMembers(community *Com skipMembers[common.PubkeyToHex(&m.identity.PublicKey)] = struct{}{} skipMembers[common.PubkeyToHex(pk)] = struct{}{} - subscriptionMsg := &CommunityPrivilegedMemberSyncMessage{ - CommunityPrivateKey: community.PrivateKey(), - } + subscriptionMsg := &CommunityPrivilegedMemberSyncMessage{} fileredPrivilegedMembers := community.GetFilteredPrivilegedMembers(skipMembers) for role, members := range fileredPrivilegedMembers { diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go index cb714e6fd..413f0f740 100644 --- a/protocol/messenger_communities.go +++ b/protocol/messenger_communities.go @@ -188,8 +188,13 @@ func (m *Messenger) publishCommunityEvents(community *communities.Community, msg } func (m *Messenger) publishCommunityPrivilegedMemberSyncMessage(msg *communities.CommunityPrivilegedMemberSyncMessage) error { + community, err := m.GetCommunityByID(msg.CommunityPrivilegedUserSyncMessage.CommunityId) + if err != nil { + return err + } - m.logger.Debug("publishing privileged user sync message", zap.Any("event", msg)) + m.logger.Debug("publishing privileged user sync message", + zap.Any("receivers", msg.Receivers), zap.Any("type", msg.CommunityPrivilegedUserSyncMessage.Type)) payload, err := proto.Marshal(msg.CommunityPrivilegedUserSyncMessage) if err != nil { @@ -198,7 +203,7 @@ func (m *Messenger) publishCommunityPrivilegedMemberSyncMessage(msg *communities rawMessage := &common.RawMessage{ Payload: payload, - Sender: msg.CommunityPrivateKey, // if empty, sender private key will be used in SendPrivate + Sender: community.PrivateKey(), SkipEncryptionLayer: true, MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE, }