entity

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: GPL-3.0 Imports: 6 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
}

type ChatType added in v0.2.0

type ChatType int
const (
	Private ChatType = iota
)

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 Message
}

func (Envelop) Proto added in v0.1.0

func (n Envelop) Proto() *pb.Message

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) (ic.PrivKey, error)

DecodePrivateKey is a helper to decode the users PrivateKey

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
}

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