Documentation
¶
Index ¶
- func ContactCodeTopic(publicKey *ecdsa.PublicKey) string
- func DiscoveryTopic() string
- func NegotiatedTopic(publicKey *ecdsa.PublicKey) string
- func PartitionedTopic(publicKey *ecdsa.PublicKey) string
- func PersonalDiscoveryTopic(publicKey *ecdsa.PublicKey) string
- func PublicKeyToStr(publicKey *ecdsa.PublicKey) string
- func StrToPublicKey(str string) (*ecdsa.PublicKey, error)
- func ToTopic(s string) []byte
- type EnvelopeEventsHandler
- type EnvelopesMonitorConfig
- type Filter
- type FiltersManager
- func (s *FiltersManager) Filter(chatID string) *Filter
- func (s *FiltersManager) FilterByFilterID(filterID string) *Filter
- func (s *FiltersManager) Filters() (result []*Filter)
- func (s *FiltersManager) FiltersByPublicKey(publicKey *ecdsa.PublicKey) (result []*Filter)
- func (s *FiltersManager) GetNegotiated(identity *ecdsa.PublicKey) *Filter
- func (s *FiltersManager) Init(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*Filter, error)
- func (s *FiltersManager) InitWithFilters(filters []*Filter) ([]*Filter, error)
- func (s *FiltersManager) LoadContactCode(pubKey *ecdsa.PublicKey) (*Filter, error)
- func (s *FiltersManager) LoadDiscovery() ([]*Filter, error)
- func (s *FiltersManager) LoadNegotiated(secret types.NegotiatedSecret) (*Filter, error)
- func (s *FiltersManager) LoadPartitioned(publicKey *ecdsa.PublicKey, identity *ecdsa.PrivateKey, listen bool) (*Filter, error)
- func (s *FiltersManager) LoadPublic(chatID string) (*Filter, error)
- func (s *FiltersManager) Remove(filters ...*Filter) error
- func (s *FiltersManager) Reset() error
- type FiltersService
- type KeysPersistence
- type RawFilter
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContactCodeTopic ¶
func DiscoveryTopic ¶
func DiscoveryTopic() string
func NegotiatedTopic ¶
func PartitionedTopic ¶
PartitionedTopic returns the associated partitioned topic string with the given public key.
func PersonalDiscoveryTopic ¶
func PublicKeyToStr ¶
Types ¶
type EnvelopeEventsHandler ¶
type EnvelopeEventsHandler interface {
EnvelopeSent([][]byte)
EnvelopeExpired([][]byte, error)
MailServerRequestCompleted(types.Hash, types.Hash, []byte, error)
MailServerRequestExpired(types.Hash)
}
EnvelopeEventsHandler used for two different event types.
type EnvelopesMonitorConfig ¶
type Filter ¶
type Filter struct {
// ChatID is the identifier of the chat
ChatID string `json:"chatId"`
// FilterID the whisper filter id generated
FilterID string `json:"filterId"`
// SymKeyID is the symmetric key id used for symmetric filters
SymKeyID string `json:"symKeyId"`
// OneToOne tells us if we need to use asymmetric encryption for this chat
OneToOne bool `json:"oneToOne"`
// Identity is the public key of the other recipient for non-public filters.
// It's encoded using encoding/hex.
Identity string `json:"identity"`
// Topic is the whisper topic
Topic types.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"`
// 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"`
}
TODO: revise fields encoding/decoding. Some are encoded using hexutil and some using encoding/hex.
type FiltersManager ¶
type FiltersManager struct {
// contains filtered or unexported fields
}
func NewFiltersManager ¶
func NewFiltersManager(persistence KeysPersistence, service FiltersService, privateKey *ecdsa.PrivateKey, logger *zap.Logger) (*FiltersManager, error)
NewFiltersManager returns a new filtersManager.
func (*FiltersManager) Filter ¶
func (s *FiltersManager) Filter(chatID string) *Filter
func (*FiltersManager) FilterByFilterID ¶
func (s *FiltersManager) FilterByFilterID(filterID string) *Filter
FilterByFilterID returns a Filter with a given Whisper filter ID.
func (*FiltersManager) Filters ¶
func (s *FiltersManager) Filters() (result []*Filter)
func (*FiltersManager) FiltersByPublicKey ¶
func (s *FiltersManager) FiltersByPublicKey(publicKey *ecdsa.PublicKey) (result []*Filter)
func (*FiltersManager) GetNegotiated ¶
func (s *FiltersManager) GetNegotiated(identity *ecdsa.PublicKey) *Filter
GetNegotiated returns a negotiated chat given an identity
func (*FiltersManager) InitWithFilters ¶
func (s *FiltersManager) InitWithFilters(filters []*Filter) ([]*Filter, error)
DEPRECATED
func (*FiltersManager) LoadContactCode ¶
func (s *FiltersManager) LoadContactCode(pubKey *ecdsa.PublicKey) (*Filter, error)
LoadContactCode creates a filter for the advertise topic for a given public key.
func (*FiltersManager) LoadDiscovery ¶
func (s *FiltersManager) LoadDiscovery() ([]*Filter, error)
LoadDiscovery adds 1 discovery filter for the personal discovery topic.
func (*FiltersManager) LoadNegotiated ¶
func (s *FiltersManager) LoadNegotiated(secret types.NegotiatedSecret) (*Filter, error)
LoadNegotiated loads a negotiated secret as a filter.
func (*FiltersManager) LoadPartitioned ¶
func (s *FiltersManager) LoadPartitioned(publicKey *ecdsa.PublicKey, identity *ecdsa.PrivateKey, listen bool) (*Filter, error)
LoadPartitioned creates a filter for a partitioned topic.
func (*FiltersManager) LoadPublic ¶
func (s *FiltersManager) LoadPublic(chatID string) (*Filter, error)
LoadPublic adds a filter for a public chat.
func (*FiltersManager) Remove ¶
func (s *FiltersManager) Remove(filters ...*Filter) error
Remove remove all the filters associated with a chat/identity
func (*FiltersManager) Reset ¶
func (s *FiltersManager) Reset() error
type FiltersService ¶
type FiltersService interface {
AddKeyPair(key *ecdsa.PrivateKey) (string, error)
DeleteKeyPair(keyID string) bool
AddSymKeyDirect(key []byte) (string, error)
AddSymKeyFromPassword(password string) (string, error)
GetSymKey(id string) ([]byte, error)
DeleteSymKey(id string) bool
Subscribe(opts *types.SubscriptionOptions) (string, error)
Unsubscribe(id string) error
}
type KeysPersistence ¶
type Transport ¶
type Transport interface {
Stop() error
JoinPrivate(publicKey *ecdsa.PublicKey) error
LeavePrivate(publicKey *ecdsa.PublicKey) error
JoinGroup(publicKeys []*ecdsa.PublicKey) error
LeaveGroup(publicKeys []*ecdsa.PublicKey) error
JoinPublic(chatID string) error
LeavePublic(chatID string) error
GetCurrentTime() uint64
SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error)
SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
SendMessagesRequest(
ctx context.Context,
peerID []byte,
from, to uint32,
previousCursor []byte,
) (cursor []byte, err error)
Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage)
InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*Filter, error)
LoadFilters(filters []*Filter) ([]*Filter, error)
RemoveFilters(filters []*Filter) error
ResetFilters() error
Filters() []*Filter
LoadKeyFilters(*ecdsa.PrivateKey) (*Filter, error)
ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*Filter, error)
RetrieveRawAll() (map[Filter][]*types.Message, error)
}