ext

package
v0.62.16 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MPL-2.0 Imports: 42 Imported by: 0

README

Whisper API Extension

API

shhext_getNewFilterMessages

Accepts the same input as shh_getFilterMessages.

Returns

Returns a list of whisper messages matching the specified filter. Filters out the messages already confirmed received by shhext_confirmMessagesProcessed

Deduplication is made using the whisper envelope content and topic only, so the same content received in different whisper envelopes will be deduplicated.

shhext_confirmMessagesProcessed

Confirms whisper messages received and processed on the client side. These messages won't appear anymore when shhext_getNewFilterMessages is called.

Parameters

Gets a list of whisper envelopes.

shhext_post

Accepts same input as shh_post.

Returns

DATA, 32 Bytes - the envelope hash

shhext_requestMessages

Sends a request for historic messages to a mail server.

Parameters
  1. Object - The message request object:
  • mailServerPeer:URL - Mail servers' enode addess
  • from:QUANTITY - (optional) Lower bound of time range as unix timestamp, default is 24 hours back from now
  • to:QUANTITY- (optional) Upper bound of time range as unix timestamp, default is now
  • topic:DATA, 4 Bytes - Regular whisper topic
  • symKeyID:DATA- ID of a symmetric key to authenticate to mail server, derived from mail server password
Returns

Boolean - returns true if the request was send, otherwise false.

Signals

Sends sent signal once per envelope.

{
  "type": "envelope.sent",
  "event": {
    "hash": "0xea0b93079ed32588628f1cabbbb5ed9e4d50b7571064c2962c3853972db67790"
  }
}

Sends expired signal if envelope dropped from whisper local queue before it was sent to any peer on the network.

{
  "type": "envelope.expired",
  "event": {
    "hash": "0x754f4c12dccb14886f791abfeb77ffb86330d03d5a4ba6f37a8c21281988b69e"
  }
}

Documentation

Index

Constants

View Source
const (
	// DefaultRequestsDelay will be used in RequestsRegistry if no other was provided.
	DefaultRequestsDelay = 3 * time.Second
)

Variables

View Source
var (
	// ErrInvalidMailServerPeer is returned when it fails to parse enode from params.
	ErrInvalidMailServerPeer = errors.New("invalid mailServerPeer value")
	// ErrInvalidSymKeyID is returned when it fails to get a symmetric key.
	ErrInvalidSymKeyID = errors.New("invalid symKeyID value")
	// ErrInvalidPublicKey is returned when public key can't be extracted
	// from MailServer's nodeID.
	ErrInvalidPublicKey = errors.New("can't extract public key")
	// ErrPFSNotEnabled is returned when an endpoint PFS only is called but
	// PFS is disabled
	ErrPFSNotEnabled = errors.New("pfs not enabled")
)

Functions

func MakeMessagesRequestPayload

func MakeMessagesRequestPayload(r MessagesRequest) ([]byte, error)

MakeMessagesRequestPayload makes a specific payload for MailServer to request historic messages. DEPRECATED

func TopicsToBloom

func TopicsToBloom(topics ...types.TopicType) []byte

TopicsToBloom squashes all topics into a single bloom filter.

func WaitForExpiredOrCompleted

func WaitForExpiredOrCompleted(requestID types.Hash, events chan types.EnvelopeEvent, timeout time.Duration) (*types.MailServerResponse, error)

Types

type ApplicationMessagesResponse

type ApplicationMessagesResponse struct {
	Messages []*common.Message `json:"messages"`
	Cursor   string            `json:"cursor"`
}

type Author

type Author struct {
	PublicKey types.HexBytes `json:"publicKey"`
	Alias     string         `json:"alias"`
	Identicon string         `json:"identicon"`
}

type Context

type Context struct {
	context.Context
}

Context provides access to request-scoped values.

func NewContext

func NewContext(ctx context.Context, source TimeSource, registry *RequestsRegistry, storage db.Storage) Context

NewContext creates Context with all required fields.

func (Context) HistoryStore

func (c Context) HistoryStore() db.HistoryStore

HistoryStore returns db.HistoryStore instance associated with this request.

func (Context) RequestRegistry

func (c Context) RequestRegistry() *RequestsRegistry

RequestRegistry returns RequestRegistry that tracks each request life-span.

func (Context) Time

func (c Context) Time() time.Time

Time returns current time using time function associated with this request.

type ContextKey

type ContextKey struct {
	Name string
}

ContextKey is a type used for keys in ext Context.

func NewContextKey

func NewContextKey(name string) ContextKey

NewContextKey returns new ContextKey instance.

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 EnvelopeSignalHandler

type EnvelopeSignalHandler struct{}

EnvelopeSignalHandler sends signals when envelope is sent or expired.

func (EnvelopeSignalHandler) EnvelopeExpired

func (h EnvelopeSignalHandler) EnvelopeExpired(identifiers [][]byte, err error)

EnvelopeExpired triggered when envelope is expired but wasn't delivered to any peer.

func (EnvelopeSignalHandler) EnvelopeSent

func (h EnvelopeSignalHandler) EnvelopeSent(identifiers [][]byte)

EnvelopeSent triggered when envelope delivered atleast to 1 peer.

func (EnvelopeSignalHandler) MailServerRequestCompleted

func (h EnvelopeSignalHandler) MailServerRequestCompleted(requestID types.Hash, lastEnvelopeHash types.Hash, cursor []byte, err error)

MailServerRequestCompleted triggered when the mailserver sends a message to notify that the request has been completed

func (EnvelopeSignalHandler) MailServerRequestExpired

func (h EnvelopeSignalHandler) MailServerRequestExpired(hash types.Hash)

MailServerRequestExpired triggered when the mailserver request expires

type EnvelopeState

type EnvelopeState int

EnvelopeState in local tracker

const (
	// NotRegistered returned if asked hash wasn't registered in the tracker.
	NotRegistered EnvelopeState = -1
	// MailServerRequestSent is set when p2p request is sent to the mailserver
	MailServerRequestSent
)

type HandlerMock

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

func NewHandlerMock

func NewHandlerMock(buf int) HandlerMock

func (HandlerMock) EnvelopeExpired

func (t HandlerMock) EnvelopeExpired(ids [][]byte, err error)

func (HandlerMock) EnvelopeSent

func (t HandlerMock) EnvelopeSent(ids [][]byte)

func (HandlerMock) MailServerRequestCompleted

func (t HandlerMock) MailServerRequestCompleted(requestID types.Hash, lastEnvelopeHash types.Hash, cursor []byte, err error)

func (HandlerMock) MailServerRequestExpired

func (t HandlerMock) MailServerRequestExpired(hash types.Hash)

type JoinRPC

type JoinRPC struct {
	Chat    string
	PubKey  types.HexBytes
	Payload types.HexBytes
}

func (JoinRPC) ID

func (m JoinRPC) ID() string

func (JoinRPC) PublicKey

func (m JoinRPC) PublicKey() *ecdsa.PublicKey

func (JoinRPC) PublicName

func (m JoinRPC) PublicName() string

type MailRequestMonitor

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

MailRequestMonitor is responsible for monitoring history request to mailservers.

func (*MailRequestMonitor) GetState

func (m *MailRequestMonitor) GetState(hash types.Hash) EnvelopeState

func (*MailRequestMonitor) Start

func (m *MailRequestMonitor) Start()

Start processing events.

func (*MailRequestMonitor) Stop

func (m *MailRequestMonitor) Stop()

Stop process events.

type MessagesRequest

type MessagesRequest struct {
	// MailServerPeer is MailServer's enode address.
	MailServerPeer string `json:"mailServerPeer"`

	// From is a lower bound of time range (optional).
	// Default is 24 hours back from now.
	From uint32 `json:"from"`

	// To is a upper bound of time range (optional).
	// Default is now.
	To uint32 `json:"to"`

	// Limit determines the number of messages sent by the mail server
	// for the current paginated request
	Limit uint32 `json:"limit"`

	// Cursor is used as starting point for paginated requests
	Cursor string `json:"cursor"`

	// Topic is a regular Whisper topic.
	// DEPRECATED
	Topic types.TopicType `json:"topic"`

	// Topics is a list of Whisper topics.
	Topics []types.TopicType `json:"topics"`

	// SymKeyID is an ID of a symmetric key to authenticate to MailServer.
	// It's derived from MailServer password.
	SymKeyID string `json:"symKeyID"`

	// Timeout is the time to live of the request specified in seconds.
	// Default is 10 seconds
	Timeout time.Duration `json:"timeout"`

	// Force ensures that requests will bypass enforced delay.
	Force bool `json:"force"`
}

MessagesRequest is a RequestMessages() request payload.

func (*MessagesRequest) SetDefaults

func (r *MessagesRequest) SetDefaults(now time.Time)

type MessagesResponse

type MessagesResponse struct {
	// Cursor from the response can be used to retrieve more messages
	// for the previous request.
	Cursor string `json:"cursor"`

	// Error indicates that something wrong happened when sending messages
	// to the requester.
	Error error `json:"error"`
}

MessagesResponse is a response for requestMessages2 method.

type Metadata

type Metadata struct {
	DedupID      []byte         `json:"dedupId"`
	EncryptionID types.HexBytes `json:"encryptionId"`
	MessageID    types.HexBytes `json:"messageId"`
	Author       Author         `json:"author"`
}

type PublicAPI

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

PublicAPI extends whisper public API.

func NewPublicAPI

func NewPublicAPI(s *Service, eventSub mailservers.EnvelopeEventSubscriber) *PublicAPI

NewPublicAPI returns instance of the public API.

func (*PublicAPI) AcceptRequestAddressForTransaction

func (api *PublicAPI) AcceptRequestAddressForTransaction(ctx context.Context, messageID, address string) (*protocol.MessengerResponse, error)

func (*PublicAPI) AcceptRequestTransaction

func (api *PublicAPI) AcceptRequestTransaction(ctx context.Context, transactionHash, messageID string, signature types.HexBytes) (*protocol.MessengerResponse, error)

func (*PublicAPI) AddAdminsToGroupChat

func (api *PublicAPI) AddAdminsToGroupChat(ctx Context, chatID string, members []string) (*protocol.MessengerResponse, error)

func (*PublicAPI) AddMembersToGroupChat

func (api *PublicAPI) AddMembersToGroupChat(ctx Context, chatID string, members []string) (*protocol.MessengerResponse, error)

func (*PublicAPI) AddPushNotificationsServer added in v0.56.1

func (api *PublicAPI) AddPushNotificationsServer(ctx context.Context, publicKeyBytes types.HexBytes) error

func (*PublicAPI) BlockContact

func (api *PublicAPI) BlockContact(parent context.Context, contact *protocol.Contact) ([]*protocol.Chat, error)

func (*PublicAPI) ChangeGroupChatName added in v0.52.1

func (api *PublicAPI) ChangeGroupChatName(ctx Context, chatID string, name string) (*protocol.MessengerResponse, error)

func (*PublicAPI) ChatMessages

func (api *PublicAPI) ChatMessages(chatID, cursor string, limit int) (*ApplicationMessagesResponse, error)

func (*PublicAPI) Chats

func (api *PublicAPI) Chats(parent context.Context) []*protocol.Chat

func (*PublicAPI) ConfirmJoiningGroup

func (api *PublicAPI) ConfirmJoiningGroup(ctx context.Context, chatID string) (*protocol.MessengerResponse, error)

func (*PublicAPI) ConfirmMessagesProcessedByID

func (api *PublicAPI) ConfirmMessagesProcessedByID(messageConfirmations []*Metadata) error

ConfirmMessagesProcessedByID is a method to confirm that messages was consumed by the client side. TODO: this is broken now as it requires dedup ID while a message hash should be used.

func (*PublicAPI) Contacts

func (api *PublicAPI) Contacts(parent context.Context) []*protocol.Contact

func (*PublicAPI) CreateGroupChatFromInvitation added in v0.60.0

func (api *PublicAPI) CreateGroupChatFromInvitation(name string, chatID string, adminPK string) (*protocol.MessengerResponse, error)

func (*PublicAPI) CreateGroupChatWithMembers

func (api *PublicAPI) CreateGroupChatWithMembers(ctx Context, name string, members []string) (*protocol.MessengerResponse, error)

func (*PublicAPI) DeclineRequestAddressForTransaction

func (api *PublicAPI) DeclineRequestAddressForTransaction(ctx context.Context, messageID string) (*protocol.MessengerResponse, error)

func (*PublicAPI) DeclineRequestTransaction

func (api *PublicAPI) DeclineRequestTransaction(ctx context.Context, messageID string) (*protocol.MessengerResponse, error)

func (*PublicAPI) DeleteChat

func (api *PublicAPI) DeleteChat(parent context.Context, chatID string) error

func (*PublicAPI) DeleteMessage

func (api *PublicAPI) DeleteMessage(id string) error

func (*PublicAPI) DeleteMessagesByChatID

func (api *PublicAPI) DeleteMessagesByChatID(id string) error

func (*PublicAPI) DisableInstallation

func (api *PublicAPI) DisableInstallation(installationID string) error

DisableInstallation disables an installation for multi-device sync.

func (*PublicAPI) DisablePushNotificationsBlockMentions added in v0.61.0

func (api *PublicAPI) DisablePushNotificationsBlockMentions(ctx context.Context) error

func (*PublicAPI) DisablePushNotificationsFromContactsOnly added in v0.56.1

func (api *PublicAPI) DisablePushNotificationsFromContactsOnly(ctx context.Context) error

func (*PublicAPI) DisableSendingNotifications added in v0.56.1

func (api *PublicAPI) DisableSendingNotifications(ctx context.Context) error

func (*PublicAPI) Echo

func (api *PublicAPI) Echo(ctx context.Context, message string) (string, error)

Echo is a method for testing purposes.

func (*PublicAPI) EmojiReactionsByChatID added in v0.56.4

func (api *PublicAPI) EmojiReactionsByChatID(chatID string, cursor string, limit int) ([]*protocol.EmojiReaction, error)

func (*PublicAPI) EnableInstallation

func (api *PublicAPI) EnableInstallation(installationID string) error

EnableInstallation enables an installation for multi-device sync.

func (*PublicAPI) EnablePushNotificationsBlockMentions added in v0.61.0

func (api *PublicAPI) EnablePushNotificationsBlockMentions(ctx context.Context) error

func (*PublicAPI) EnablePushNotificationsFromContactsOnly added in v0.56.1

func (api *PublicAPI) EnablePushNotificationsFromContactsOnly(ctx context.Context) error

func (*PublicAPI) EnableSendingNotifications added in v0.56.1

func (api *PublicAPI) EnableSendingNotifications(ctx context.Context) error

func (*PublicAPI) GetContactByID added in v0.55.1

func (api *PublicAPI) GetContactByID(parent context.Context, id string) *protocol.Contact

func (*PublicAPI) GetGroupChatInvitations added in v0.60.0

func (api *PublicAPI) GetGroupChatInvitations() ([]*protocol.GroupChatInvitation, error)

func (*PublicAPI) GetLinkPreviewData added in v0.62.15

func (api *PublicAPI) GetLinkPreviewData(link string) (previewData urls.LinkPreviewData, err error)

func (*PublicAPI) GetLinkPreviewWhitelist added in v0.62.15

func (api *PublicAPI) GetLinkPreviewWhitelist() []urls.Site

func (*PublicAPI) GetOurInstallations

func (api *PublicAPI) GetOurInstallations() []*multidevice.Installation

GetOurInstallations returns all the installations available given an identity

func (*PublicAPI) GetPushNotificationsServers added in v0.59.0

func (api *PublicAPI) GetPushNotificationsServers() ([]*pushnotificationclient.PushNotificationServer, error)

func (*PublicAPI) Join

func (api *PublicAPI) Join(chat protocol.Chat) error

func (*PublicAPI) Leave

func (api *PublicAPI) Leave(chat protocol.Chat) error

func (*PublicAPI) LeaveGroupChat

func (api *PublicAPI) LeaveGroupChat(ctx Context, chatID string, remove bool) (*protocol.MessengerResponse, error)

func (*PublicAPI) LoadFilters

func (api *PublicAPI) LoadFilters(parent context.Context, chats []*transport.Filter) ([]*transport.Filter, error)

func (*PublicAPI) MarkAllRead added in v0.47.0

func (api *PublicAPI) MarkAllRead(chatID string) error

func (*PublicAPI) MarkMessagesSeen

func (api *PublicAPI) MarkMessagesSeen(chatID string, ids []string) (uint64, error)

func (*PublicAPI) MuteChat added in v0.56.1

func (api *PublicAPI) MuteChat(parent context.Context, chatID string) error

func (*PublicAPI) ReSendChatMessage

func (api *PublicAPI) ReSendChatMessage(ctx context.Context, messageID string) error

func (*PublicAPI) RegisterForPushNotifications added in v0.56.1

func (api *PublicAPI) RegisterForPushNotifications(ctx context.Context, deviceToken string, apnTopic string, tokenType protobuf.PushNotificationRegistration_TokenType) error

func (*PublicAPI) RegisteredForPushNotifications added in v0.56.1

func (api *PublicAPI) RegisteredForPushNotifications() (bool, error)

func (*PublicAPI) RemoveFilters

func (api *PublicAPI) RemoveFilters(parent context.Context, chats []*transport.Filter) error

func (*PublicAPI) RemoveMemberFromGroupChat

func (api *PublicAPI) RemoveMemberFromGroupChat(ctx Context, chatID string, member string) (*protocol.MessengerResponse, error)

func (*PublicAPI) RemovePushNotificationServer added in v0.56.1

func (api *PublicAPI) RemovePushNotificationServer(ctx context.Context, publicKeyBytes types.HexBytes) error

func (*PublicAPI) RequestAddressForTransaction

func (api *PublicAPI) RequestAddressForTransaction(ctx context.Context, chatID, from, value, contract string) (*protocol.MessengerResponse, error)

func (*PublicAPI) RequestTransaction

func (api *PublicAPI) RequestTransaction(ctx context.Context, chatID, value, contract, address string) (*protocol.MessengerResponse, error)

func (*PublicAPI) SaveChat

func (api *PublicAPI) SaveChat(parent context.Context, chat *protocol.Chat) error

func (*PublicAPI) SaveContact

func (api *PublicAPI) SaveContact(parent context.Context, contact *protocol.Contact) error

func (*PublicAPI) SendChatMessage

func (api *PublicAPI) SendChatMessage(ctx context.Context, message *common.Message) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendContactUpdate

func (api *PublicAPI) SendContactUpdate(ctx context.Context, contactID, name, picture string) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendContactUpdates

func (api *PublicAPI) SendContactUpdates(ctx context.Context, name, picture string) error

func (*PublicAPI) SendEmojiReaction added in v0.56.4

func (api *PublicAPI) SendEmojiReaction(ctx context.Context, chatID, messageID string, emojiID protobuf.EmojiReaction_Type) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendEmojiReactionRetraction added in v0.56.4

func (api *PublicAPI) SendEmojiReactionRetraction(ctx context.Context, emojiReactionID string) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendGroupChatInvitationRejection added in v0.60.0

func (api *PublicAPI) SendGroupChatInvitationRejection(ctx Context, invitationRequestID string) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendGroupChatInvitationRequest added in v0.60.0

func (api *PublicAPI) SendGroupChatInvitationRequest(ctx Context, chatID string, adminPK string, message string) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendPairInstallation

func (api *PublicAPI) SendPairInstallation(ctx context.Context) (*protocol.MessengerResponse, error)

func (*PublicAPI) SendTransaction

func (api *PublicAPI) SendTransaction(ctx context.Context, chatID, value, contract, transactionHash string, signature types.HexBytes) (*protocol.MessengerResponse, error)

func (*PublicAPI) SetInstallationMetadata

func (api *PublicAPI) SetInstallationMetadata(installationID string, data *multidevice.InstallationMetadata) error

SetInstallationMetadata sets the metadata for our own installation

func (*PublicAPI) SignMessageWithChatKey added in v0.56.6

func (api *PublicAPI) SignMessageWithChatKey(ctx context.Context, message string) (types.HexBytes, error)

func (*PublicAPI) StartMessenger added in v0.41.0

func (api *PublicAPI) StartMessenger() error

func (*PublicAPI) StartPushNotificationsServer added in v0.56.1

func (api *PublicAPI) StartPushNotificationsServer() error

func (*PublicAPI) StopPushNotificationsServer added in v0.56.1

func (api *PublicAPI) StopPushNotificationsServer() error

func (*PublicAPI) SyncDevices

func (api *PublicAPI) SyncDevices(ctx context.Context, name, picture string) error

func (*PublicAPI) UnmuteChat added in v0.56.1

func (api *PublicAPI) UnmuteChat(parent context.Context, chatID string) error

func (*PublicAPI) UnregisterFromPushNotifications added in v0.59.0

func (api *PublicAPI) UnregisterFromPushNotifications(ctx context.Context) error

func (*PublicAPI) UpdateMailservers added in v0.45.1

func (api *PublicAPI) UpdateMailservers(enodes []string) error

func (*PublicAPI) UpdateMessageOutgoingStatus

func (api *PublicAPI) UpdateMessageOutgoingStatus(id, newOutgoingStatus string) error

type PublisherSignalHandler

type PublisherSignalHandler struct{}

PublisherSignalHandler sends signals on protocol events

func (PublisherSignalHandler) BundleAdded

func (h PublisherSignalHandler) BundleAdded(identity string, installationID string)

func (PublisherSignalHandler) DecryptMessageFailed

func (h PublisherSignalHandler) DecryptMessageFailed(pubKey string)

func (PublisherSignalHandler) FilterAdded

func (h PublisherSignalHandler) FilterAdded(filters []*signal.Filter)

func (PublisherSignalHandler) NewMessages

func (h PublisherSignalHandler) NewMessages(response *protocol.MessengerResponse)

type RequestsRegistry

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

RequestsRegistry keeps map for all requests with timestamp when they were made.

func NewRequestsRegistry

func NewRequestsRegistry(delay time.Duration) *RequestsRegistry

NewRequestsRegistry creates instance of the RequestsRegistry and returns pointer to it.

func (*RequestsRegistry) Clear

func (r *RequestsRegistry) Clear()

Clear recreates all structures used for caching requests.

func (*RequestsRegistry) Has

func (r *RequestsRegistry) Has(uid types.Hash) bool

Has returns true if given uid is stored in registry.

func (*RequestsRegistry) Register

func (r *RequestsRegistry) Register(uid types.Hash, topics []types.TopicType) error

Register request with given topics. If request with same topics was made in less then configured delay then error will be returned.

func (*RequestsRegistry) Unregister

func (r *RequestsRegistry) Unregister(uid types.Hash)

Unregister removes request with given UID from registry.

type RetryConfig

type RetryConfig struct {
	BaseTimeout time.Duration
	// StepTimeout defines duration increase per each retry.
	StepTimeout time.Duration
	MaxRetries  int
}

RetryConfig specifies configuration for retries with timeout and max amount of retries.

type SendDirectMessageRPC

type SendDirectMessageRPC struct {
	Sig     string // TODO: remove
	Chat    string
	Payload types.HexBytes
	PubKey  types.HexBytes
	DH      bool // TODO: make sure to remove safely
}

SendDirectMessageRPC represents the RPC payload for the SendDirectMessage RPC method

func (SendDirectMessageRPC) ID

TODO: implement with accordance to https://github.com/status-im/status-go/protocol/issues/28.

func (SendDirectMessageRPC) PublicKey

func (m SendDirectMessageRPC) PublicKey() *ecdsa.PublicKey

func (SendDirectMessageRPC) PublicName

func (m SendDirectMessageRPC) PublicName() string

type SendPublicMessageRPC

type SendPublicMessageRPC struct {
	Sig     string // TODO: remove
	Chat    string
	Payload types.HexBytes
}

SendPublicMessageRPC represents the RPC payload for the SendPublicMessage RPC method

func (SendPublicMessageRPC) ID

TODO: implement with accordance to https://github.com/status-im/status-go/protocol/issues/28.

func (SendPublicMessageRPC) PublicKey

func (m SendPublicMessageRPC) PublicKey() *ecdsa.PublicKey

func (SendPublicMessageRPC) PublicName

func (m SendPublicMessageRPC) PublicName() string

type Service

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

Service is a service that provides some additional API to whisper-based protocols like Whisper or Waku.

func New

func New(
	config params.ShhextConfig,
	n types.Node,
	ldb *leveldb.DB,
	mailMonitor *MailRequestMonitor,
	reqRegistry *RequestsRegistry,
	eventSub mailservers.EnvelopeEventSubscriber,
) *Service

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs returns a list of new APIs.

func (*Service) ConfirmMessagesProcessed

func (s *Service) ConfirmMessagesProcessed(messageIDs [][]byte) error

func (*Service) DisableInstallation

func (s *Service) DisableInstallation(installationID string) error

DisableInstallation disables an installation for multi-device sync.

func (*Service) EnableInstallation

func (s *Service) EnableInstallation(installationID string) error

func (*Service) GetPeer

func (s *Service) GetPeer(rawURL string) (*enode.Node, error)

func (*Service) InitProtocol

func (s *Service) InitProtocol(identity *ecdsa.PrivateKey, db *sql.DB, logger *zap.Logger) error

func (*Service) NodeID

func (s *Service) NodeID() *ecdsa.PrivateKey

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns a new protocols list. In this case, there are none.

func (*Service) RequestsRegistry

func (s *Service) RequestsRegistry() *RequestsRegistry

func (*Service) Start

func (s *Service) Start(server *p2p.Server) error

Start is run when a service is started. It does nothing in this case but is required by `node.Service` interface.

func (*Service) StartMessenger added in v0.41.0

func (s *Service) StartMessenger() error

func (*Service) Stop

func (s *Service) Stop() error

Stop is run when a service is stopped.

func (*Service) UpdateMailservers

func (s *Service) UpdateMailservers(nodes []*enode.Node) error

UpdateMailservers updates information about selected mail servers.

type TestNodeWrapper

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

func NewTestNodeWrapper

func NewTestNodeWrapper(whisper types.Whisper, waku types.Waku) *TestNodeWrapper

func (*TestNodeWrapper) AddPeer

func (w *TestNodeWrapper) AddPeer(url string) error

func (*TestNodeWrapper) GetWaku

func (w *TestNodeWrapper) GetWaku(_ interface{}) (types.Waku, error)

func (*TestNodeWrapper) GetWhisper

func (w *TestNodeWrapper) GetWhisper(_ interface{}) (types.Whisper, error)

func (*TestNodeWrapper) NewENSVerifier

func (w *TestNodeWrapper) NewENSVerifier(_ *zap.Logger) enstypes.ENSVerifier

func (*TestNodeWrapper) PeersCount added in v0.59.0

func (w *TestNodeWrapper) PeersCount() int

func (*TestNodeWrapper) RemovePeer

func (w *TestNodeWrapper) RemovePeer(url string) error

type TimeSource

type TimeSource func() time.Time

TimeSource is a type used for current time.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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