2
0
mirror of https://github.com/status-im/status-go.git synced 2025-02-28 14:40:55 +00:00
Alexander c46e395a58
Extend peersyncing to sync 1-to-1 messages ()
* fix_: extend peersyncing to sync 1-to-1 messages

* fix_: tests
2024-05-14 12:20:13 +02:00

31 lines
609 B
Go

package peersyncing
import "errors"
type SyncMessageType int
type SyncMessage struct {
ID []byte
Type SyncMessageType
ChatID []byte
Payload []byte
Timestamp uint64
}
var ErrSyncMessageNotValid = errors.New("sync message not valid")
func (s *SyncMessage) Valid() error {
valid := len(s.ID) != 0 && s.Type != SyncMessageNoType && len(s.ChatID) != 0 && len(s.Payload) != 0 && s.Timestamp != 0
if !valid {
return ErrSyncMessageNotValid
}
return nil
}
const (
SyncMessageNoType SyncMessageType = iota
SyncMessageCommunityType
SyncMessageOneToOneType
SyncMessagePrivateGroup
)