shhapi

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2016 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIs

func APIs() []rpc.API

APIs returns the RPC descriptors the Whisper implementation offers

Types

type PostArgs

type PostArgs struct {
	TTL      uint32              `json:"ttl"`
	From     rpc.HexBytes        `json:"from"`
	To       rpc.HexBytes        `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 int                 `json:"filter"`
	PeerID   rpc.HexBytes        `json:"directP2P"`
}

func (*PostArgs) UnmarshalJSON

func (args *PostArgs) UnmarshalJSON(data []byte) (err error)

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 rpc.HexNumber) []WhisperMessage

GetFilterChanges retrieves all the new messages matched by a filter since the last retrieval.

func (*PublicWhisperAPI) GetMessages

func (api *PublicWhisperAPI) GetMessages(filterId rpc.HexNumber) []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) (*rpc.HexNumber, 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

func (api *PublicWhisperAPI) RequestHistoricMessages(peerID rpc.HexBytes, data rpc.HexBytes) error

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) UninstallFilter

func (api *PublicWhisperAPI) UninstallFilter(filterId rpc.HexNumber)

UninstallFilter disables and removes an existing filter.

func (*PublicWhisperAPI) Version

func (api *PublicWhisperAPI) Version() (*rpc.HexNumber, error)

Version returns the Whisper version this node offers.

type WhisperFilterArgs

type WhisperFilterArgs struct {
	To        []byte
	From      []byte
	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.

Jump to

Keyboard shortcuts

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