Documentation
¶
Index ¶
- func APIs() []rpc.API
- type PostArgs
- type PublicWhisperAPI
- func (api *PublicWhisperAPI) AddSymKey(name string, key []byte) error
- func (api *PublicWhisperAPI) DeleteIdentity(identity string) error
- func (api *PublicWhisperAPI) DeleteSymKey(name string) error
- func (api *PublicWhisperAPI) GenerateSymKey(name string) error
- func (api *PublicWhisperAPI) GetFilterChanges(filterId uint32) []WhisperMessage
- func (api *PublicWhisperAPI) GetMessages(filterId uint32) []WhisperMessage
- func (api *PublicWhisperAPI) HasIdentity(identity string) (bool, error)
- func (api *PublicWhisperAPI) HasSymKey(name string) (bool, error)
- func (api *PublicWhisperAPI) MarkPeerTrusted(peerID rpc.HexBytes) error
- func (api *PublicWhisperAPI) NewFilter(args WhisperFilterArgs) (uint32, error)
- func (api *PublicWhisperAPI) NewIdentity() (string, error)
- func (api *PublicWhisperAPI) Post(args PostArgs) error
- func (api *PublicWhisperAPI) RequestHistoricMessages(peerID rpc.HexBytes, data rpc.HexBytes) error
- func (api *PublicWhisperAPI) Start() error
- func (api *PublicWhisperAPI) Stop() error
- func (api *PublicWhisperAPI) UninstallFilter(filterId uint32)
- func (api *PublicWhisperAPI) Version() (*rpc.HexNumber, error)
- type WhisperFilterArgs
- type WhisperMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PostArgs ¶
type PostArgs struct { TTL uint32 `json:"ttl"` From string `json:"from"` To string `json:"to"` KeyName string `json:"keyname"` Topic whisperv5.TopicType `json:"topic"` Padding rpc.HexBytes `json:"padding"` Payload rpc.HexBytes `json:"payload"` WorkTime uint32 `json:"worktime"` PoW float64 `json:"pow"` FilterID uint32 `json:"filterID"` PeerID rpc.HexBytes `json:"peerID"` }
type PublicWhisperAPI ¶
type PublicWhisperAPI struct {
// contains filtered or unexported fields
}
PublicWhisperAPI provides the whisper RPC service.
func NewPublicWhisperAPI ¶
func NewPublicWhisperAPI() *PublicWhisperAPI
NewPublicWhisperAPI create a new RPC whisper service.
func (*PublicWhisperAPI) AddSymKey ¶
func (api *PublicWhisperAPI) AddSymKey(name string, key []byte) error
AddSymKey stores the key under the 'name' id.
func (*PublicWhisperAPI) DeleteIdentity ¶
func (api *PublicWhisperAPI) DeleteIdentity(identity string) error
DeleteIdentity deletes the specifies key if it exists.
func (*PublicWhisperAPI) DeleteSymKey ¶
func (api *PublicWhisperAPI) DeleteSymKey(name string) error
DeleteSymKey deletes the key associated with the name string if it exists.
func (*PublicWhisperAPI) GenerateSymKey ¶
func (api *PublicWhisperAPI) GenerateSymKey(name string) error
GenerateSymKey generates a random symmetric key and stores it under the 'name' id. Will be used in the future for session key exchange.
func (*PublicWhisperAPI) GetFilterChanges ¶
func (api *PublicWhisperAPI) GetFilterChanges(filterId uint32) []WhisperMessage
GetFilterChanges retrieves all the new messages matched by a filter since the last retrieval.
func (*PublicWhisperAPI) GetMessages ¶
func (api *PublicWhisperAPI) GetMessages(filterId uint32) []WhisperMessage
GetMessages retrieves all the known messages that match a specific filter.
func (*PublicWhisperAPI) HasIdentity ¶
func (api *PublicWhisperAPI) HasIdentity(identity string) (bool, error)
HasIdentity checks if the whisper node is configured with the private key of the specified public pair.
func (*PublicWhisperAPI) HasSymKey ¶
func (api *PublicWhisperAPI) HasSymKey(name string) (bool, error)
HasSymKey returns true if there is a key associated with the name string. Otherwise returns false.
func (*PublicWhisperAPI) MarkPeerTrusted ¶
func (api *PublicWhisperAPI) MarkPeerTrusted(peerID rpc.HexBytes) error
MarkPeerTrusted marks specific peer trusted, which will allow it to send historic (expired) messages.
func (*PublicWhisperAPI) NewFilter ¶
func (api *PublicWhisperAPI) NewFilter(args WhisperFilterArgs) (uint32, error)
NewWhisperFilter creates and registers a new message filter to watch for inbound whisper messages. Returns the ID of the newly created Filter.
func (*PublicWhisperAPI) NewIdentity ¶
func (api *PublicWhisperAPI) NewIdentity() (string, error)
NewIdentity generates a new cryptographic identity for the client, and injects it into the known identities for message decryption.
func (*PublicWhisperAPI) Post ¶
func (api *PublicWhisperAPI) Post(args PostArgs) error
Post creates a whisper message and injects it into the network for distribution.
func (*PublicWhisperAPI) RequestHistoricMessages ¶
RequestHistoricMessages requests the peer to deliver the old (expired) messages. data contains parameters (time frame, payment details, etc.), required by the remote email-like server. Whisper is not aware about the data format, it will just forward the raw data to the server.
func (*PublicWhisperAPI) Start ¶
func (api *PublicWhisperAPI) Start() error
Start starts the Whisper worker threads.
func (*PublicWhisperAPI) Stop ¶
func (api *PublicWhisperAPI) Stop() error
Stop stops the Whisper worker threads.
func (*PublicWhisperAPI) UninstallFilter ¶
func (api *PublicWhisperAPI) UninstallFilter(filterId uint32)
UninstallFilter disables and removes an existing filter.
type WhisperFilterArgs ¶
type WhisperFilterArgs struct { To string From string KeyName string PoW float64 Topics []whisperv5.TopicType AcceptP2P bool }
func (*WhisperFilterArgs) UnmarshalJSON ¶
func (args *WhisperFilterArgs) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON implements the json.Unmarshaler interface, invoked to convert a JSON message blob into a WhisperFilterArgs structure.
type WhisperMessage ¶
type WhisperMessage struct { Payload string `json:"payload"` Padding string `json:"padding"` From string `json:"from"` To string `json:"to"` Sent uint32 `json:"sent"` TTL uint32 `json:"ttl"` PoW float64 `json:"pow"` Hash string `json:"hash"` }
WhisperMessage is the RPC representation of a whisper message.
func NewWhisperMessage ¶
func NewWhisperMessage(message *whisperv5.ReceivedMessage) WhisperMessage
NewWhisperMessage converts an internal message into an API version.