publisher

package
v0.30.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrPFSNotEnabled is returned when an endpoint PFS only is called but
	// PFS is disabled.
	ErrPFSNotEnabled = errors.New("pfs not enabled")

	// ErrNoProtocolMessage means that a message was not a protocol message,
	// that is it could not be unmarshaled.
	ErrNoProtocolMessage = errors.New("not a protocol message")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	PFSEnabled bool
}

type Persistence

type Persistence interface {
	GetLastPublished() (int64, error)
	SetLastPublished(int64) error
	GetLastAcked(identity []byte) (int64, error)
	SetLastAcked(identity []byte, lastAcked int64) error
}

type Publisher

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

func New

func New(w *whisper.Whisper, c Config) *Publisher

func (*Publisher) ConfirmMessagesProcessed

func (p *Publisher) ConfirmMessagesProcessed(ids [][]byte) error

func (*Publisher) CreateDirectMessage

func (p *Publisher) CreateDirectMessage(privateKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey, DH bool, payload []byte) (*whisper.NewMessage, error)

CreateDirectMessage creates a 1:1 chat message

func (*Publisher) CreatePublicMessage

func (p *Publisher) CreatePublicMessage(privateKey *ecdsa.PrivateKey, chatID string, payload []byte, wrap bool) (*whisper.NewMessage, error)

CreatePublicMessage sends a public chat message to the underlying transport

func (*Publisher) DisableInstallation

func (p *Publisher) DisableInstallation(installationID string) error

DisableInstallation disables an installation for multi-device sync.

func (*Publisher) EnableInstallation

func (p *Publisher) EnableInstallation(installationID string) error

EnableInstallation enables an installation for multi-device sync.

func (*Publisher) GetBundle

func (p *Publisher) GetBundle(myIdentityKey *ecdsa.PrivateKey) (*protobuf.Bundle, error)

func (*Publisher) GetOurInstallations

func (p *Publisher) GetOurInstallations() ([]*multidevice.Installation, error)

GetOurInstallations returns all the installations available given an identity

func (*Publisher) GetPublicBundle

func (p *Publisher) GetPublicBundle(identityKey *ecdsa.PublicKey) (*protobuf.Bundle, error)

func (*Publisher) Init

func (p *Publisher) Init(db *sql.DB, protocol *chat.ProtocolService, onNewMessagesHandler func([]*filter.Messages))

func (*Publisher) LoadFilter

func (p *Publisher) LoadFilter(chat *filter.Chat) ([]*filter.Chat, error)

func (*Publisher) LoadFilters

func (p *Publisher) LoadFilters(chats []*filter.Chat) ([]*filter.Chat, error)

func (*Publisher) ProcessMessage

func (p *Publisher) ProcessMessage(msg *whisper.Message, msgID []byte) error

func (*Publisher) ProcessNegotiatedSecret

func (p *Publisher) ProcessNegotiatedSecret(secrets []*sharedsecret.Secret)

func (*Publisher) ProcessPublicBundle

func (p *Publisher) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *protobuf.Bundle) ([]*multidevice.Installation, error)

func (*Publisher) RemoveFilters

func (p *Publisher) RemoveFilters(chats []*filter.Chat) error

func (*Publisher) SetInstallationMetadata

func (p *Publisher) SetInstallationMetadata(installationID string, data *multidevice.InstallationMetadata) error

SetInstallationMetadata sets the metadata for our own installation

func (*Publisher) Start

func (p *Publisher) Start(online func() bool, startTicker bool) error

func (*Publisher) Stop

func (p *Publisher) Stop() error

type SQLLitePersistence

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

func NewSQLLitePersistence

func NewSQLLitePersistence(db *sql.DB) *SQLLitePersistence

func (*SQLLitePersistence) GetLastAcked

func (s *SQLLitePersistence) GetLastAcked(identity []byte) (int64, error)

func (*SQLLitePersistence) GetLastPublished

func (s *SQLLitePersistence) GetLastPublished() (int64, error)

func (*SQLLitePersistence) SetLastAcked

func (s *SQLLitePersistence) SetLastAcked(identity []byte, lastAcked int64) error

func (*SQLLitePersistence) SetLastPublished

func (s *SQLLitePersistence) SetLastPublished(lastPublished int64) error

Jump to

Keyboard shortcuts

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