entity

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2023 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatInfo

type ChatInfo struct {
	ID         ID
	Name       string
	Members    []Contact
	Type       ChatType
	Unread     uint64
	LatestText string
	Admins     []Contact
}

func NewGroupChat added in v0.3.0

func NewGroupChat(name string, members []Contact, admins []Contact) ChatInfo

func NewPrivateChat added in v0.3.0

func NewPrivateChat(creator Contact, con Contact) ChatInfo

func ToChatInfo added in v0.3.0

func ToChatInfo(pbmsg *pb.Request) ChatInfo

func (ChatInfo) Proto added in v0.3.0

func (m ChatInfo) Proto() proto.Message

type ChatType added in v0.2.0

type ChatType int
const (
	Private ChatType = iota
	Group
)

type Contact

type Contact struct {
	ID   ID
	Name string
}

func (Contact) AdderInfo added in v0.1.0

func (c Contact) AdderInfo() (*peer.AddrInfo, error)

func (Contact) PeerID added in v0.1.0

func (c Contact) PeerID() (peer.ID, error)

type Envelop added in v0.1.0

type Envelop struct {
	To        Contact
	Message   ProtoMessage
	ID        string
	CreatedAt int64
	Protocol  protocol.ID
}

func NewMessageEnvelop added in v0.3.0

func NewMessageEnvelop(c Contact, m Message) (*Envelop, error)

func (Envelop) PeerID added in v0.3.0

func (e Envelop) PeerID() peer.ID

type ID added in v0.1.0

type ID string

func (ID) String added in v0.1.0

func (id ID) String() string

type Identity

type Identity struct {
	ID      ID
	Name    string
	PrivKey string
}

func CreateIdentity

func CreateIdentity(name string) (Identity, error)

func (*Identity) DecodePrivateKey

func (i *Identity) DecodePrivateKey(passphrase string) (crypto.PrivKey, error)

DecodePrivateKey is a helper to decode the users PrivateKey

func (Identity) PeerID added in v0.3.0

func (c Identity) PeerID() (peer.ID, error)

func (*Identity) ToContact added in v0.2.0

func (i *Identity) ToContact() *Contact

type Message

type Message struct {
	ID        ID
	ChatID    ID
	CreatedAt int64
	Text      string
	Status    Status
	Author    Contact
	ChatType  ChatType
}

func ToMessage added in v0.3.0

func ToMessage(pbmsg *pb.Message) Message

func (Message) Proto added in v0.3.0

func (m Message) Proto() proto.Message

type ProtoMessage added in v0.3.0

type ProtoMessage interface {
	Proto() proto.Message
}

type PubSubEnvelop added in v0.3.0

type PubSubEnvelop struct {
	Topic   string
	Message ProtoMessage
}

type Status

type Status int
const (
	Pending Status = iota
	Sent
	Seen
	Received
	Failed
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL