2020-07-20 17:06:38 +00:00
|
|
|
package protocol
|
|
|
|
|
2020-07-25 14:16:00 +00:00
|
|
|
import (
|
|
|
|
"crypto/ecdsa"
|
|
|
|
|
2020-07-25 16:13:08 +00:00
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
|
2020-07-25 14:16:00 +00:00
|
|
|
"github.com/status-im/status-go/protocol/protobuf"
|
|
|
|
)
|
2020-07-20 17:06:38 +00:00
|
|
|
|
|
|
|
// EmojiReaction represents an emoji reaction from a user in the application layer, used for persistence, querying and
|
|
|
|
// signaling
|
|
|
|
type EmojiReaction struct {
|
2020-07-25 14:16:00 +00:00
|
|
|
protobuf.EmojiReaction
|
|
|
|
|
2020-07-20 17:06:38 +00:00
|
|
|
// ID calculated as keccak256(compressedAuthorPubKey, data) where data is unencrypted payload.
|
|
|
|
ID string
|
|
|
|
|
|
|
|
// From is a public key of the author of the emoji reaction.
|
|
|
|
From string
|
|
|
|
|
|
|
|
// Retracted represents whether the user has chosen to remove a previously given reaction
|
|
|
|
Retracted bool
|
2020-07-25 14:16:00 +00:00
|
|
|
|
|
|
|
// SigPubKey is the ecdsa encoded public key of the emoji reaction author
|
|
|
|
SigPubKey *ecdsa.PublicKey `json:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetSigPubKey returns an ecdsa encoded public key
|
2020-07-25 16:13:08 +00:00
|
|
|
// this function is required to implement the ChatEntity interface
|
2020-07-25 14:16:00 +00:00
|
|
|
func (e EmojiReaction) GetSigPubKey() *ecdsa.PublicKey {
|
|
|
|
return e.SigPubKey
|
2020-07-20 17:06:38 +00:00
|
|
|
}
|
2020-07-25 16:13:08 +00:00
|
|
|
|
|
|
|
// GetProtoBuf returns the struct's embedded protobuf struct
|
|
|
|
// this function is required to implement the ChatEntity interface
|
|
|
|
func (e EmojiReaction) GetProtobuf() proto.Message {
|
|
|
|
return &e.EmojiReaction
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMessageType a setter for the MessageType field
|
|
|
|
// this function is required to implement the ChatEntity interface
|
|
|
|
func (e *EmojiReaction) SetMessageType(messageType protobuf.MessageType) {
|
|
|
|
e.MessageType = messageType
|
|
|
|
}
|