github.com/status-im/status-go@v1.1.0/protocol/delete_message.go (about)

     1  package protocol
     2  
     3  import (
     4  	"crypto/ecdsa"
     5  
     6  	"github.com/golang/protobuf/proto"
     7  
     8  	"github.com/status-im/status-go/protocol/protobuf"
     9  )
    10  
    11  // DeleteMessage represents a delete of a message from a user in the application layer, used for persistence, querying and
    12  // signaling
    13  type DeleteMessage struct {
    14  	*protobuf.DeleteMessage
    15  
    16  	// ID is the ID of the message that has been edited
    17  	ID string `json:"id,omitempty"`
    18  
    19  	// From is a public key of the author of the edit reaction.
    20  	From string `json:"from,omitempty"`
    21  
    22  	// SigPubKey is the ecdsa encoded public key of the edit author
    23  	SigPubKey *ecdsa.PublicKey `json:"-"`
    24  }
    25  
    26  func NewDeleteMessage() *DeleteMessage {
    27  	return &DeleteMessage{DeleteMessage: &protobuf.DeleteMessage{}}
    28  }
    29  
    30  // GetSigPubKey returns an ecdsa encoded public key
    31  // this function is required to implement the ChatEntity interface
    32  func (e *DeleteMessage) GetSigPubKey() *ecdsa.PublicKey {
    33  	return e.SigPubKey
    34  }
    35  
    36  // GetProtoBuf returns the struct's embedded protobuf struct
    37  // this function is required to implement the ChatEntity interface
    38  func (e *DeleteMessage) GetProtobuf() proto.Message {
    39  	return e.DeleteMessage
    40  }
    41  
    42  // SetMessageType a setter for the MessageType field
    43  // this function is required to implement the ChatEntity interface
    44  func (e *DeleteMessage) SetMessageType(messageType protobuf.MessageType) {
    45  	e.MessageType = messageType
    46  }
    47  
    48  // WrapGroupMessage indicates whether we should wrap this in membership information
    49  func (e *DeleteMessage) WrapGroupMessage() bool {
    50  	return false
    51  }