filter

package
v0.26.0-alpha.15 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublicKeyToPartitionedTopic

func PublicKeyToPartitionedTopic(publicKey *ecdsa.PublicKey) string

func PublicKeyToPartitionedTopicBytes

func PublicKeyToPartitionedTopicBytes(publicKey *ecdsa.PublicKey) []byte

func ToTopic

func ToTopic(s string) []byte

Types

type Chat

type Chat struct {
	// ChatID is the identifier of the chat
	ChatID string `json:"chatId"`
	// SymKeyID is the symmetric key id used for symmetric chats
	SymKeyID string `json:"symKeyId"`
	// OneToOne tells us if we need to use asymmetric encryption for this chat
	OneToOne bool `json:"oneToOne"`
	// Listen is whether we are actually listening for messages on this chat, or the filter is only created in order to be able to post on the topic
	Listen bool `json:"listen"`
	// FilterID the whisper filter id generated
	FilterID string `json:"filterId"`
	// Identity is the public key of the other recipient for non-public chats
	Identity string `json:"identity"`
	// Topic is the whisper topic
	Topic whisper.TopicType `json:"topic"`
}

type Filter

type Filter struct {
	FilterID string
	Topic    whisper.TopicType
	SymKeyID string
}

type Service

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

func New

func New(k string, w *whisper.Whisper, t *topic.Service) *Service

func (*Service) AddAsymmetricFilter

func (s *Service) AddAsymmetricFilter(keyAsym *ecdsa.PrivateKey, chatID string, listen bool) (*Filter, error)

func (*Service) AddSymmetric

func (s *Service) AddSymmetric(chatID string) (*Filter, error)

func (*Service) Get

func (s *Service) Get(identity *ecdsa.PublicKey) *Chat

func (*Service) Init

func (s *Service) Init(chats []*Chat) (map[string]*Chat, error)

func (*Service) Load

func (s *Service) Load(chat *Chat) (*Chat, error)

func (*Service) LoadDiscovery

func (s *Service) LoadDiscovery(myKey *ecdsa.PrivateKey) error

LoadDiscovery adds the discovery filter

func (*Service) LoadOneToOne

func (s *Service) LoadOneToOne(myKey *ecdsa.PrivateKey, identity string, listen bool) error

LoadOneToOne creates two filters for a given chat, one listening to the contact codes and another on the partitioned topic. We pass a listen parameter to indicated whether we are listening to messages on the partitioned topic

func (*Service) LoadPublic

func (s *Service) LoadPublic(chat *Chat) error

func (*Service) ProcessNegotiatedSecret

func (s *Service) ProcessNegotiatedSecret(secret *topic.Secret) (*Chat, error)

func (*Service) Remove

func (s *Service) Remove(chat *Chat) error

func (*Service) Stop

func (s *Service) Stop() error

Jump to

Keyboard shortcuts

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