Documentation ¶
Index ¶
- Variables
- func NewJSONHexEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func RegisterJSONHexEncoder() error
- func WithDatasync() func(c *config) error
- type Chat
- type ChatMessages
- type Messenger
- func (m *Messenger) AddMailserver(enode string) error
- func (m *Messenger) ConfirmMessagesProcessed(messageIDs [][]byte) error
- func (m *Messenger) DisableInstallation(id string) error
- func (m *Messenger) EnableInstallation(id string) error
- func (m *Messenger) Installations() ([]*multidevice.Installation, error)
- func (m *Messenger) Join(chat Chat) error
- func (m *Messenger) Leave(chat Chat) error
- func (m *Messenger) LoadFilters(chats []*filter.Chat) ([]*filter.Chat, error)
- func (m *Messenger) Mailservers() ([]string, error)
- func (m *Messenger) RemoveFilters(chats []*filter.Chat) error
- func (m *Messenger) RemoveMailserver(id string) error
- func (m *Messenger) Retrieve(ctx context.Context, chat Chat, c RetrieveConfig) (messages []*protocol.Message, err error)
- func (m *Messenger) RetrieveAll(ctx context.Context, c RetrieveConfig) (allMessages []*protocol.Message, err error)
- func (m *Messenger) RetrieveRawAll() (map[filter.Chat][]*protocol.StatusMessage, error)
- func (m *Messenger) SelectMailserver(id string) error
- func (m *Messenger) Send(ctx context.Context, chat Chat, data []byte) ([]byte, error)
- func (m *Messenger) SendRaw(ctx context.Context, chat Chat, data []byte) ([]byte, whisper.NewMessage, error)
- func (m *Messenger) SetInstallationMetadata(id string, data *multidevice.InstallationMetadata) error
- func (m *Messenger) Shutdown() (err error)
- type Option
- func WithCustomLogger(logger *zap.Logger) Option
- func WithDatabase(db *sql.DB) Option
- func WithDatabaseConfig(dbPath, dbKey string) Option
- func WithGenericDiscoveryTopicSupport() Option
- func WithMessagesPersistenceEnabled() Option
- func WithOnNewInstallationsHandler(h func([]*multidevice.Installation)) Option
- func WithOnNewSharedSecret(h func([]*sharedsecret.Secret)) Option
- func WithSendV1Messages() Option
- type RetrieveConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrChatIDEmpty = errors.New("chat ID is empty") ErrNotImplemented = errors.New("not implemented") )
var ( RetrieveLatest = RetrieveConfig{/* contains filtered or unexported fields */} RetrieveLastDay = RetrieveConfig{/* contains filtered or unexported fields */} )
var ( // ErrMsgAlreadyExist returned if msg already exist. ErrMsgAlreadyExist = errors.New("message with given ID already exist") )
Functions ¶
func NewJSONHexEncoder ¶ added in v0.1.1
func NewJSONHexEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewJSONHexEncoder creates a JSON logger based on zapcore.NewJSONEncoder but overwrites encoding of byte slices. Instead encoding them with base64, jsonHexEncoder uses hex-encoding. Each hex-encoded value is prefixed with 0x so that it's clear it's a hex string.
func RegisterJSONHexEncoder ¶ added in v0.1.1
func RegisterJSONHexEncoder() error
RegisterJSONHexEncoder registers a jsonHexEncoder under "json-hex" name. Later, this name can be used as a value for zap.Config.Encoding to enable jsonHexEncoder.
func WithDatasync ¶
func WithDatasync() func(c *config) error
Types ¶
type ChatMessages ¶
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
Messenger is a entity managing chats and messages. It acts as a bridge between the application and encryption layers. It needs to expose an interface to manage installations because installations are managed by the user. Similarly, it needs to expose an interface to manage mailservers because they can also be managed by the user.
func NewMessenger ¶
func (*Messenger) AddMailserver ¶
NOT IMPLEMENTED
func (*Messenger) ConfirmMessagesProcessed ¶
DEPRECATED
func (*Messenger) DisableInstallation ¶
func (*Messenger) EnableInstallation ¶
func (*Messenger) Installations ¶
func (m *Messenger) Installations() ([]*multidevice.Installation, error)
func (*Messenger) LoadFilters ¶
DEPRECATED
func (*Messenger) RemoveFilters ¶
DEPRECATED
func (*Messenger) RemoveMailserver ¶
NOT IMPLEMENTED
func (*Messenger) RetrieveAll ¶
func (m *Messenger) RetrieveAll(ctx context.Context, c RetrieveConfig) (allMessages []*protocol.Message, err error)
RetrieveAll retrieves all previously fetched messages
func (*Messenger) RetrieveRawAll ¶
DEPRECATED
func (*Messenger) SelectMailserver ¶
NOT IMPLEMENTED
func (*Messenger) SendRaw ¶
func (m *Messenger) SendRaw(ctx context.Context, chat Chat, data []byte) ([]byte, whisper.NewMessage, error)
SendRaw takes encoded data, encrypts it and sends through the wire. DEPRECATED
func (*Messenger) SetInstallationMetadata ¶
func (m *Messenger) SetInstallationMetadata(id string, data *multidevice.InstallationMetadata) error
type Option ¶
type Option func(*config) error
func WithCustomLogger ¶
func WithDatabase ¶
func WithDatabaseConfig ¶
func WithGenericDiscoveryTopicSupport ¶
func WithGenericDiscoveryTopicSupport() Option
func WithMessagesPersistenceEnabled ¶
func WithMessagesPersistenceEnabled() Option
func WithOnNewInstallationsHandler ¶
func WithOnNewInstallationsHandler(h func([]*multidevice.Installation)) Option
func WithOnNewSharedSecret ¶
func WithOnNewSharedSecret(h func([]*sharedsecret.Secret)) Option
func WithSendV1Messages ¶
func WithSendV1Messages() Option