Documentation ¶
Index ¶
- Variables
- type DebugAPI
- type EnvelopeEventsHandler
- type EnvelopeSignalHandler
- func (h EnvelopeSignalHandler) BundleAdded(identity string, installationID string)
- func (h EnvelopeSignalHandler) DecryptMessageFailed(pubKey string)
- func (h EnvelopeSignalHandler) EnvelopeExpired(hash common.Hash)
- func (h EnvelopeSignalHandler) EnvelopeSent(hash common.Hash)
- func (h EnvelopeSignalHandler) MailServerRequestCompleted(requestID common.Hash, lastEnvelopeHash common.Hash, cursor []byte, err error)
- func (h EnvelopeSignalHandler) MailServerRequestExpired(hash common.Hash)
- type EnvelopeState
- type MessagesRequest
- type MessagesRequestPayload
- type PublicAPI
- func (api *PublicAPI) ConfirmMessagesProcessed(messages []*whisper.Message) error
- func (api *PublicAPI) GetNewFilterMessages(filterID string) ([]*whisper.Message, error)
- func (api *PublicAPI) Post(ctx context.Context, req whisper.NewMessage) (hash hexutil.Bytes, err error)
- func (api *PublicAPI) RequestMessages(_ context.Context, r MessagesRequest) (hexutil.Bytes, error)
- func (api *PublicAPI) SendDirectMessage(ctx context.Context, msg chat.SendDirectMessageRPC) ([]hexutil.Bytes, error)
- func (api *PublicAPI) SendGroupMessage(ctx context.Context, msg chat.SendGroupMessageRPC) ([]hexutil.Bytes, error)
- func (api *PublicAPI) SendPairingMessage(ctx context.Context, msg chat.SendDirectMessageRPC) ([]hexutil.Bytes, error)
- func (api *PublicAPI) SendPublicMessage(ctx context.Context, msg chat.SendPublicMessageRPC) (hexutil.Bytes, error)
- type Service
- func (s *Service) APIs() []rpc.API
- func (s *Service) GetBundle(myIdentityKey *ecdsa.PrivateKey) (*chat.Bundle, error)
- func (s *Service) InitProtocol(address string, password string) error
- func (s *Service) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *chat.Bundle) ([]chat.IdentityAndIDPair, error)
- func (s *Service) Protocols() []p2p.Protocol
- func (s *Service) Start(server *p2p.Server) error
- func (s *Service) Stop() error
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
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 ¶
This section is empty.
Types ¶
type DebugAPI ¶
type DebugAPI struct {
// contains filtered or unexported fields
}
DebugAPI represents a set of APIs from the `web3.debug` namespace.
func NewDebugAPI ¶
NewDebugAPI creates an instance of the debug API.
type EnvelopeEventsHandler ¶
type EnvelopeEventsHandler interface { EnvelopeSent(common.Hash) EnvelopeExpired(common.Hash) MailServerRequestCompleted(common.Hash, common.Hash, []byte, error) MailServerRequestExpired(common.Hash) }
EnvelopeEventsHandler used for two different event types.
type EnvelopeSignalHandler ¶
type EnvelopeSignalHandler struct{}
EnvelopeSignalHandler sends signals when envelope is sent or expired.
func (EnvelopeSignalHandler) BundleAdded ¶ added in v0.16.4
func (h EnvelopeSignalHandler) BundleAdded(identity string, installationID string)
func (EnvelopeSignalHandler) DecryptMessageFailed ¶ added in v0.15.1
func (h EnvelopeSignalHandler) DecryptMessageFailed(pubKey string)
func (EnvelopeSignalHandler) EnvelopeExpired ¶
func (h EnvelopeSignalHandler) EnvelopeExpired(hash common.Hash)
EnvelopeExpired triggered when envelope is expired but wasn't delivered to any peer.
func (EnvelopeSignalHandler) EnvelopeSent ¶
func (h EnvelopeSignalHandler) EnvelopeSent(hash common.Hash)
EnvelopeSent triggered when envelope delivered atleast to 1 peer.
func (EnvelopeSignalHandler) MailServerRequestCompleted ¶
func (h EnvelopeSignalHandler) MailServerRequestCompleted(requestID common.Hash, lastEnvelopeHash common.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 common.Hash)
MailServerRequestExpired triggered when the mailserver request expires
type EnvelopeState ¶
type EnvelopeState int
EnvelopeState in local tracker
const ( // EnvelopePosted is set when envelope was added to a local whisper queue. EnvelopePosted EnvelopeState = iota // EnvelopeSent is set when envelope is sent to atleast one peer. EnvelopeSent // MailServerRequestSent is set when p2p request is sent to the mailserver MailServerRequestSent )
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 whisper.TopicType `json:"topic"` // Topics is a list of Whisper topics. Topics []whisper.TopicType `json:"topics"` // SymKeyID is an ID of a symmetric key to authenticate to MailServer. // It's derived from MailServer password. // // It's also possible to authenticate request with MailServerPeer // public key. 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"` }
MessagesRequest is a payload send to a MailServer to get messages.
type MessagesRequestPayload ¶ added in v0.16.4
type MessagesRequestPayload struct { // Lower is a lower bound of time range for which messages are requested. Lower uint32 // Upper is a lower bound of time range for which messages are requested. Upper uint32 // Bloom is a bloom filter to filter envelopes. Bloom []byte // Limit is the max number of envelopes to return. Limit uint32 // Cursor is used for pagination of the results. Cursor []byte // Batch set to true indicates that the client supports batched response. Batch bool }
MessagesRequestPayload is a payload sent to the Mail Server.
type PublicAPI ¶
type PublicAPI struct {
// contains filtered or unexported fields
}
PublicAPI extends whisper public API.
func NewPublicAPI ¶
NewPublicAPI returns instance of the public API.
func (*PublicAPI) ConfirmMessagesProcessed ¶
ConfirmMessagesProcessed is a method to confirm that messages was consumed by the client side.
func (*PublicAPI) GetNewFilterMessages ¶
GetNewFilterMessages is a prototype method with deduplication
func (*PublicAPI) Post ¶
func (api *PublicAPI) Post(ctx context.Context, req whisper.NewMessage) (hash hexutil.Bytes, err error)
Post shamelessly copied from whisper codebase with slight modifications.
func (*PublicAPI) RequestMessages ¶
RequestMessages sends a request for historic messages to a MailServer.
func (*PublicAPI) SendDirectMessage ¶ added in v0.15.1
func (api *PublicAPI) SendDirectMessage(ctx context.Context, msg chat.SendDirectMessageRPC) ([]hexutil.Bytes, error)
SendDirectMessage sends a 1:1 chat message to the underlying transport
func (*PublicAPI) SendGroupMessage ¶ added in v0.15.1
func (api *PublicAPI) SendGroupMessage(ctx context.Context, msg chat.SendGroupMessageRPC) ([]hexutil.Bytes, error)
SendGroupMessage sends a group messag chat message to the underlying transport
func (*PublicAPI) SendPairingMessage ¶ added in v0.16.4
func (api *PublicAPI) SendPairingMessage(ctx context.Context, msg chat.SendDirectMessageRPC) ([]hexutil.Bytes, error)
SendPairingMessage sends a 1:1 chat message to our own devices to initiate a pairing session
func (*PublicAPI) SendPublicMessage ¶ added in v0.15.1
func (api *PublicAPI) SendPublicMessage(ctx context.Context, msg chat.SendPublicMessageRPC) (hexutil.Bytes, error)
SendPublicMessage sends a public chat message to the underlying transport
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a service that provides some additional Whisper API.
func New ¶
func New(w *whisper.Whisper, handler EnvelopeEventsHandler, db *leveldb.DB, config *ServiceConfig) *Service
New returns a new Service. dataDir is a folder path to a network-independent location
func (*Service) InitProtocol ¶ added in v0.15.1
InitProtocol create an instance of ProtocolService given an address and password
func (*Service) ProcessPublicBundle ¶ added in v0.15.1
func (s *Service) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *chat.Bundle) ([]chat.IdentityAndIDPair, error)