diff --git a/protocol/anonmetrics/client.go b/protocol/anonmetrics/client.go index 66ccbfa65..c0e683856 100644 --- a/protocol/anonmetrics/client.go +++ b/protocol/anonmetrics/client.go @@ -98,7 +98,7 @@ func (c *Client) sendUnprocessedMetrics() { rawMessage := common.RawMessage{ Payload: encodedMessage, Sender: ephemeralKey, - SkipEncryption: true, + SkipProtocolLayer: true, SendOnPersonalTopic: true, MessageType: protobuf.ApplicationMetadataMessage_ANONYMOUS_METRIC_BATCH, } diff --git a/protocol/common/message_sender.go b/protocol/common/message_sender.go index 9bc6a045c..b61e3f958 100644 --- a/protocol/common/message_sender.go +++ b/protocol/common/message_sender.go @@ -159,7 +159,7 @@ func (s *MessageSender) SendPrivate( // Currently we don't support sending through datasync and setting custom waku fields, // as the datasync interface is not rich enough to propagate that information, so we // would have to add some complexity to handle this. - if rawMessage.ResendAutomatically && (rawMessage.Sender != nil || rawMessage.SkipEncryption || rawMessage.SendOnPersonalTopic) { + if rawMessage.ResendAutomatically && (rawMessage.Sender != nil || rawMessage.SkipProtocolLayer || rawMessage.SendOnPersonalTopic) { return nil, errors.New("setting identity, skip-encryption or personal topic and datasync not supported") } @@ -395,8 +395,8 @@ func (s *MessageSender) sendPrivate( return nil, err } } - } else if rawMessage.SkipEncryption { - // When SkipEncryption is set we don't pass the message to the encryption layer + } else if rawMessage.SkipProtocolLayer { + // When SkipProtocolLayer is set we don't pass the message to the encryption layer messageIDs := [][]byte{messageID} hash, newMessage, err := s.sendPrivateRawMessage(ctx, rawMessage, recipient, wrappedMessage, messageIDs) if err != nil { @@ -404,7 +404,7 @@ func (s *MessageSender) sendPrivate( return nil, errors.Wrap(err, "failed to send a message spec") } - s.logger.Debug("sent private message skipEncryption", zap.String("messageID", messageID.String()), zap.String("hash", types.EncodeHex(hash))) + s.logger.Debug("sent private message skipProtocolLayer", zap.String("messageID", messageID.String()), zap.String("hash", types.EncodeHex(hash))) s.transport.Track(messageIDs, hash, newMessage) @@ -571,7 +571,7 @@ func (s *MessageSender) SendPublic( return nil, errors.Wrap(err, "failed to wrap a public message in the encryption layer") } - if !rawMessage.SkipEncryption { + if !rawMessage.SkipProtocolLayer { newMessage, err = MessageSpecToWhisper(messageSpec) if err != nil { return nil, err diff --git a/protocol/common/raw_message.go b/protocol/common/raw_message.go index 96209b33c..fe5fd7fad 100644 --- a/protocol/common/raw_message.go +++ b/protocol/common/raw_message.go @@ -23,7 +23,7 @@ type RawMessage struct { SendCount int Sent bool ResendAutomatically bool - SkipEncryption bool + SkipProtocolLayer bool // don't wrap message into ProtocolMessage SendPushNotification bool MessageType protobuf.ApplicationMetadataMessage_Type Payload []byte diff --git a/protocol/common/raw_messages_persistence.go b/protocol/common/raw_messages_persistence.go index 96178e882..24a7fee63 100644 --- a/protocol/common/raw_messages_persistence.go +++ b/protocol/common/raw_messages_persistence.go @@ -96,7 +96,7 @@ func (db RawMessagesPersistence) SaveRawMessage(message *RawMessage) error { message.MessageType, message.ResendAutomatically, encodedRecipients.Bytes(), - message.SkipEncryption, + message.SkipProtocolLayer, message.SendPushNotification, message.SkipGroupMessageWrap, message.SendOnPersonalTopic, @@ -157,7 +157,7 @@ func (db RawMessagesPersistence) rawMessageByID(tx *sql.Tx, id string) (*RawMess &message.MessageType, &message.ResendAutomatically, &encodedRecipients, - &message.SkipEncryption, + &message.SkipProtocolLayer, &message.SendPushNotification, &skipGroupMessageWrap, &sendOnPersonalTopic, diff --git a/protocol/messenger.go b/protocol/messenger.go index 4b4453334..c73ca76f6 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -1959,7 +1959,7 @@ func (m *Messenger) dispatchMessage(ctx context.Context, rawMessage common.RawMe //SendPrivate will alter message identity and possibly datasyncid, so we save an unchanged //message for sending to paired devices later specCopyForPairedDevices := rawMessage - if !common.IsPubKeyEqual(publicKey, &m.identity.PublicKey) || rawMessage.SkipEncryption { + if !common.IsPubKeyEqual(publicKey, &m.identity.PublicKey) || rawMessage.SkipProtocolLayer { id, err = m.sender.SendPrivate(ctx, publicKey, &rawMessage) if err != nil { diff --git a/protocol/messenger_backup.go b/protocol/messenger_backup.go index 76d7e52bb..8caf5f114 100644 --- a/protocol/messenger_backup.go +++ b/protocol/messenger_backup.go @@ -229,7 +229,7 @@ func (m *Messenger) encodeAndDispatchBackupMessage(ctx context.Context, message _, err = m.dispatchMessage(ctx, common.RawMessage{ LocalChatID: chatID, Payload: encodedMessage, - SkipEncryption: true, + SkipProtocolLayer: true, SendOnPersonalTopic: true, MessageType: protobuf.ApplicationMetadataMessage_BACKUP, }) diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go index fb1602648..26c85ba4f 100644 --- a/protocol/messenger_communities.go +++ b/protocol/messenger_communities.go @@ -76,8 +76,8 @@ func (m *Messenger) publishOrg(org *communities.Community) error { Payload: payload, Sender: org.PrivateKey(), // we don't want to wrap in an encryption layer message - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_DESCRIPTION, + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_DESCRIPTION, } _, err = m.sender.SendPublic(context.Background(), org.IDString(), rawMessage) return err @@ -99,8 +99,8 @@ func (m *Messenger) publishOrgInvitation(org *communities.Community, invitation Payload: payload, Sender: org.PrivateKey(), // we don't want to wrap in an encryption layer message - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_INVITATION, + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_INVITATION, } _, err = m.sender.SendPrivate(context.Background(), pk, &rawMessage) return err @@ -123,8 +123,8 @@ func (m *Messenger) publishCommunityAdminEvent(adminEvent *protobuf.CommunityAdm Payload: payload, Sender: m.identity, // we don't want to wrap in an encryption layer message - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_ADMIN_MESSAGE, + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_ADMIN_MESSAGE, } _, err = m.sender.SendPublic(context.Background(), types.EncodeHex(adminEvent.CommunityId), rawMessage) @@ -778,10 +778,10 @@ func (m *Messenger) RequestToJoinCommunity(request *requests.RequestToJoinCommun } rawMessage := common.RawMessage{ - Payload: payload, - CommunityID: community.ID(), - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN, + Payload: payload, + CommunityID: community.ID(), + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN, } _, err = m.sender.SendCommunityMessage(context.Background(), rawMessage) @@ -949,10 +949,10 @@ func (m *Messenger) CancelRequestToJoinCommunity(request *requests.CancelRequest } rawMessage := common.RawMessage{ - Payload: payload, - CommunityID: community.ID(), - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_CANCEL_REQUEST_TO_JOIN, + Payload: payload, + CommunityID: community.ID(), + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_CANCEL_REQUEST_TO_JOIN, } _, err = m.sender.SendCommunityMessage(context.Background(), rawMessage) @@ -1044,10 +1044,10 @@ func (m *Messenger) AcceptRequestToJoinCommunity(request *requests.AcceptRequest } rawMessage := &common.RawMessage{ - Payload: payload, - Sender: community.PrivateKey(), - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN_RESPONSE, + Payload: payload, + Sender: community.PrivateKey(), + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN_RESPONSE, } _, err = m.sender.SendPrivate(context.Background(), pk, rawMessage) @@ -1156,10 +1156,10 @@ func (m *Messenger) LeaveCommunity(communityID types.HexBytes) (*MessengerRespon } rawMessage := common.RawMessage{ - Payload: payload, - CommunityID: communityID, - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_LEAVE, + Payload: payload, + CommunityID: communityID, + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_LEAVE, } _, err = m.sender.SendCommunityMessage(context.Background(), rawMessage) if err != nil { @@ -1749,7 +1749,7 @@ func (m *Messenger) RemoveUserFromCommunity(id types.HexBytes, pkString string) func (m *Messenger) SendKeyExchangeMessage(communityID []byte, pubkeys []*ecdsa.PublicKey, msgType common.CommKeyExMsgType) error { rawMessage := common.RawMessage{ - SkipEncryption: false, + SkipProtocolLayer: false, CommunityID: communityID, CommunityKeyExMsgType: msgType, Recipients: pubkeys, diff --git a/protocol/pushnotificationclient/client.go b/protocol/pushnotificationclient/client.go index bc8f8cf64..4a4b06468 100644 --- a/protocol/pushnotificationclient/client.go +++ b/protocol/pushnotificationclient/client.go @@ -1298,7 +1298,7 @@ func (c *Client) registerWithServer(registration *protobuf.PushNotificationRegis MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REGISTRATION, // We send on personal topic to avoid a lot of traffic on the partitioned topic SendOnPersonalTopic: true, - SkipEncryption: true, + SkipProtocolLayer: true, } _, err = c.messageSender.SendPrivate(context.Background(), server.PublicKey, &rawMessage) @@ -1406,8 +1406,8 @@ func (c *Client) SendNotification(publicKey *ecdsa.PublicKey, installationIDs [] Sender: ephemeralKey, // we skip encryption as we don't want to save any key material // for an ephemeral key, no need to use pfs as these are throw away keys - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REQUEST, + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REQUEST, } _, err = c.messageSender.SendPrivate(context.Background(), serverPublicKey, &rawMessage) @@ -1686,8 +1686,8 @@ func (c *Client) queryPushNotificationInfo(publicKey *ecdsa.PublicKey) error { Payload: encodedMessage, Sender: ephemeralKey, // we don't want to wrap in an encryption layer message - SkipEncryption: true, - MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_QUERY, + SkipProtocolLayer: true, + MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_QUERY, } _, err = c.messageSender.AddEphemeralKey(ephemeralKey) diff --git a/protocol/pushnotificationserver/server.go b/protocol/pushnotificationserver/server.go index 52c85438c..976f138f5 100644 --- a/protocol/pushnotificationserver/server.go +++ b/protocol/pushnotificationserver/server.go @@ -109,7 +109,7 @@ func (s *Server) HandlePushNotificationRegistration(publicKey *ecdsa.PublicKey, Payload: encodedMessage, MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REGISTRATION_RESPONSE, // we skip encryption as might be sent from an ephemeral key - SkipEncryption: true, + SkipProtocolLayer: true, } _, err = s.messageSender.SendPrivate(context.Background(), publicKey, &rawMessage) @@ -132,7 +132,7 @@ func (s *Server) HandlePushNotificationQuery(publicKey *ecdsa.PublicKey, message Payload: encodedMessage, MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_QUERY_RESPONSE, // we skip encryption as sent from an ephemeral key - SkipEncryption: true, + SkipProtocolLayer: true, } _, err = s.messageSender.SendPrivate(context.Background(), publicKey, &rawMessage) @@ -175,7 +175,7 @@ func (s *Server) HandlePushNotificationRequest(publicKey *ecdsa.PublicKey, Payload: encodedMessage, MessageType: protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_RESPONSE, // We skip encryption here as the message has been sent from an ephemeral key - SkipEncryption: true, + SkipProtocolLayer: true, } _, err = s.messageSender.SendPrivate(context.Background(), publicKey, &rawMessage)