Documentation ¶
Index ¶
- func ContactCodeTopic(identity string) string
- func PublicKeyToPartitionedTopic(publicKey *ecdsa.PublicKey) string
- func PublicKeyToPartitionedTopicBytes(publicKey *ecdsa.PublicKey) []byte
- func ToTopic(s string) []byte
- type Chat
- type Filter
- type Messages
- type Persistence
- type SQLLitePersistence
- type Service
- func (s *Service) GetByID(chatID string) *Chat
- func (s *Service) GetNegotiated(identity *ecdsa.PublicKey) *Chat
- func (s *Service) Init(chats []*Chat) ([]*Chat, error)
- func (s *Service) Load(chat *Chat) ([]*Chat, error)
- func (s *Service) LoadPartitioned(myKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, listen bool) (*Chat, error)
- func (s *Service) ProcessNegotiatedSecret(secret *sharedsecret.Secret) (*Chat, error)
- func (s *Service) Remove(chats []*Chat) error
- func (s *Service) Start(checkPeriod time.Duration)
- func (s *Service) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContactCodeTopic ¶
func PublicKeyToPartitionedTopic ¶
PublicKeyToPartitionedTopic returns the associated partitioned topic string with the given public key
func PublicKeyToPartitionedTopicBytes ¶
PublicKeyToPartitionedTopicBytes returns the bytes of the partitioned topic associated with the given public key
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"` // Discovery is whether this is a discovery topic Discovery bool `json:"discovery"` // Negotiated tells us whether is a negotiated topic Negotiated bool `json:"negotiated"` }
type Persistence ¶
type SQLLitePersistence ¶
type SQLLitePersistence struct {
// contains filtered or unexported fields
}
func NewSQLLitePersistence ¶
func NewSQLLitePersistence(db *sql.DB) *SQLLitePersistence
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(w *whisper.Whisper, p Persistence, s *sharedsecret.Service, onNewMessages func([]*Messages)) *Service
New returns a new filter service
func (*Service) GetNegotiated ¶
Get returns a negotiated chat given an identity
func (*Service) LoadPartitioned ¶
func (s *Service) LoadPartitioned(myKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, listen bool) (*Chat, error)
LoadPartitioned creates a filter for a partitioned topic
func (*Service) ProcessNegotiatedSecret ¶
func (s *Service) ProcessNegotiatedSecret(secret *sharedsecret.Secret) (*Chat, error)
ProcessNegotiatedSecret adds a filter based on the agreed secret
Click to show internal directories.
Click to hide internal directories.