2021-07-26 21:06:32 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/ecdsa"
|
|
|
|
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/protocol/protobuf"
|
|
|
|
)
|
|
|
|
|
|
|
|
// DeleteMessage represents a delete of a message from a user in the application layer, used for persistence, querying and
|
|
|
|
// signaling
|
|
|
|
type DeleteMessage struct {
|
2023-08-18 11:39:59 +00:00
|
|
|
*protobuf.DeleteMessage
|
2021-07-26 21:06:32 +00:00
|
|
|
|
|
|
|
// ID is the ID of the message that has been edited
|
|
|
|
ID string `json:"id,omitempty"`
|
|
|
|
|
|
|
|
// From is a public key of the author of the edit reaction.
|
|
|
|
From string `json:"from,omitempty"`
|
|
|
|
|
|
|
|
// SigPubKey is the ecdsa encoded public key of the edit author
|
|
|
|
SigPubKey *ecdsa.PublicKey `json:"-"`
|
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func NewDeleteMessage() *DeleteMessage {
|
|
|
|
return &DeleteMessage{DeleteMessage: &protobuf.DeleteMessage{}}
|
|
|
|
}
|
|
|
|
|
2021-07-26 21:06:32 +00:00
|
|
|
// GetSigPubKey returns an ecdsa encoded public key
|
|
|
|
// this function is required to implement the ChatEntity interface
|
2023-08-18 11:39:59 +00:00
|
|
|
func (e *DeleteMessage) GetSigPubKey() *ecdsa.PublicKey {
|
2021-07-26 21:06:32 +00:00
|
|
|
return e.SigPubKey
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetProtoBuf returns the struct's embedded protobuf struct
|
|
|
|
// this function is required to implement the ChatEntity interface
|
2023-08-18 11:39:59 +00:00
|
|
|
func (e *DeleteMessage) GetProtobuf() proto.Message {
|
|
|
|
return e.DeleteMessage
|
2021-07-26 21:06:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetMessageType a setter for the MessageType field
|
|
|
|
// this function is required to implement the ChatEntity interface
|
|
|
|
func (e *DeleteMessage) SetMessageType(messageType protobuf.MessageType) {
|
|
|
|
e.MessageType = messageType
|
|
|
|
}
|
|
|
|
|
|
|
|
// WrapGroupMessage indicates whether we should wrap this in membership information
|
2023-08-18 11:39:59 +00:00
|
|
|
func (e *DeleteMessage) WrapGroupMessage() bool {
|
2021-07-26 21:06:32 +00:00
|
|
|
return false
|
|
|
|
}
|