chat

package
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	FetchPreKeyBundle(userIDPubKey ed25519.PublicKey) (x3dh.PreKeyBundle, error)
	SubmitMessages(messages []*bpb.ChatMessage) error
	FetchSignedPreKey(userIdPubKey ed25519.PublicKey) (preKey.PreKey, error)
	AddRequestHandler(handler backend.RequestHandler)
	Close() error
}

type Chat

type Chat struct {
	// contains filtered or unexported fields
}

func NewChat

func NewChat(conf Config) (*Chat, error)

func (*Chat) AddUserToGroupChat

func (c *Chat) AddUserToGroupChat(partners []ed25519.PublicKey, chatID int) error

func (*Chat) AllChats

func (c *Chat) AllChats() ([]db.Chat, error)

func (*Chat) Close

func (c *Chat) Close() error

func (*Chat) CreateGroupChat

func (c *Chat) CreateGroupChat(partners []ed25519.PublicKey, name string) (int, error)

func (*Chat) MarkMessagesAsRead

func (c *Chat) MarkMessagesAsRead(chatID int) error

func (*Chat) Messages

func (c *Chat) Messages(partner ed25519.PublicKey, start int64, amount uint) ([]*db.Message, error)

func (*Chat) SaveMessage

func (c *Chat) SaveMessage(chatID int, rawMessage []byte) error

func (*Chat) SendMessage

func (c *Chat) SendMessage(receiver ed25519.PublicKey, dbMessage db.Message) error

send a message

type Config

type Config struct {
	ChatStorage          db.ChatStorage
	Backend              Backend
	SharedSecretDB       db.SharedSecretStorage
	KM                   *keyManager.KeyManager
	DRKeyStorage         dr.KeysStorage
	SignedPreKeyStorage  db.SignedPreKeyStorage
	OneTimePreKeyStorage db.OneTimePreKeyStorage
	UserStorage          db.UserStorage
	UiApi                *uiapi.Api
	Queue                *queue.Queue
}

type SubmitMessagesProcessor

type SubmitMessagesProcessor struct {
	// contains filtered or unexported fields
}

processor that submits messages from the queue to the backend

func (*SubmitMessagesProcessor) Process

func (p *SubmitMessagesProcessor) Process(j queue.Job) error

func (*SubmitMessagesProcessor) Type

func (p *SubmitMessagesProcessor) Type() string

func (*SubmitMessagesProcessor) ValidJob

func (p *SubmitMessagesProcessor) ValidJob(j queue.Job) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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