diff --git a/eth-node/bridge/geth/public_waku_api.go b/eth-node/bridge/geth/public_waku_api.go index 6d04b6f47..7016d52b1 100644 --- a/eth-node/bridge/geth/public_waku_api.go +++ b/eth-node/bridge/geth/public_waku_api.go @@ -103,6 +103,7 @@ func (w *gethPublicWakuAPIWrapper) Post(ctx context.Context, req types.NewMessag PowTime: req.PowTime, PowTarget: req.PowTarget, TargetPeer: req.TargetPeer, + Ephemeral: req.Ephemeral, } return w.api.Post(ctx, msg) } diff --git a/eth-node/bridge/geth/public_wakuv2_api.go b/eth-node/bridge/geth/public_wakuv2_api.go index e3c2b2cf4..3d06e73a8 100644 --- a/eth-node/bridge/geth/public_wakuv2_api.go +++ b/eth-node/bridge/geth/public_wakuv2_api.go @@ -95,6 +95,7 @@ func (w *gethPublicWakuV2APIWrapper) Post(ctx context.Context, req types.NewMess Payload: req.Payload, Padding: req.Padding, TargetPeer: req.TargetPeer, + Ephemeral: req.Ephemeral, } return w.api.Post(ctx, msg) } diff --git a/eth-node/types/rpc.go b/eth-node/types/rpc.go index 85d103dbf..c2101e31f 100644 --- a/eth-node/types/rpc.go +++ b/eth-node/types/rpc.go @@ -16,6 +16,7 @@ type NewMessage struct { PowTime uint32 `json:"powTime"` PowTarget float64 `json:"powTarget"` TargetPeer string `json:"targetPeer"` + Ephemeral bool `json:"ephemeral"` } // Message is the RPC representation of a whisper message. diff --git a/protocol/common/message_sender.go b/protocol/common/message_sender.go index 36277d87e..732cc2c2a 100644 --- a/protocol/common/message_sender.go +++ b/protocol/common/message_sender.go @@ -551,6 +551,8 @@ func (s *MessageSender) SendPublic( } } + newMessage.Ephemeral = rawMessage.Ephemeral + messageID := v1protocol.MessageID(&rawMessage.Sender.PublicKey, wrappedMessage) rawMessage.ID = types.EncodeHex(messageID) diff --git a/protocol/common/raw_message.go b/protocol/common/raw_message.go index dc8f79dee..2fbbd5751 100644 --- a/protocol/common/raw_message.go +++ b/protocol/common/raw_message.go @@ -33,4 +33,5 @@ type RawMessage struct { SendOnPersonalTopic bool CommunityID []byte CommunityKeyExMsgType CommKeyExMsgType + Ephemeral bool } diff --git a/protocol/messenger_status_updates.go b/protocol/messenger_status_updates.go index ac9c9318b..b19b07d4a 100644 --- a/protocol/messenger_status_updates.go +++ b/protocol/messenger_status_updates.go @@ -68,6 +68,7 @@ func (m *Messenger) sendUserStatus(ctx context.Context, status UserStatus) error Payload: encodedMessage, MessageType: protobuf.ApplicationMetadataMessage_STATUS_UPDATE, ResendAutomatically: true, + Ephemeral: statusUpdate.StatusType == protobuf.StatusUpdate_AUTOMATIC, } _, err = m.sender.SendPublic(ctx, contactCodeTopic, rawMessage) @@ -168,6 +169,7 @@ func (m *Messenger) sendCurrentUserStatusToCommunity(ctx context.Context, commun Payload: encodedMessage, MessageType: protobuf.ApplicationMetadataMessage_STATUS_UPDATE, ResendAutomatically: true, + Ephemeral: statusUpdate.StatusType == protobuf.StatusUpdate_AUTOMATIC, } _, err = m.sender.SendPublic(ctx, rawMessage.LocalChatID, rawMessage) diff --git a/waku/api.go b/waku/api.go index 9c6c2206d..61d85ef20 100644 --- a/waku/api.go +++ b/waku/api.go @@ -222,6 +222,7 @@ type NewMessage struct { PowTime uint32 `json:"powTime"` PowTarget float64 `json:"powTarget"` TargetPeer string `json:"targetPeer"` + Ephemeral bool `json:"ephemeral"` } // Post posts a message on the Waku network. diff --git a/wakuv2/api.go b/wakuv2/api.go index b1cf3aa7e..5248a4731 100644 --- a/wakuv2/api.go +++ b/wakuv2/api.go @@ -179,6 +179,7 @@ type NewMessage struct { Payload []byte `json:"payload"` Padding []byte `json:"padding"` TargetPeer string `json:"targetPeer"` + Ephemeral bool `json:"ephemeral"` } // Post posts a message on the Waku network. @@ -253,6 +254,7 @@ func (api *PublicWakuAPI) Post(ctx context.Context, req NewMessage) (hexutil.Byt Version: version, ContentTopic: req.Topic.ContentTopic(), Timestamp: utils.GetUnixEpoch(), + Ephemeral: req.Ephemeral, } hash, err := api.w.Send(wakuMsg)