shhapi

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2017 License: GPL-3.0 Imports: 11 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     string              `json:"from"`
	To       string              `json:"to"`
	KeyName  string              `json:"keyname"`
	Topic    whisperv5.TopicType `json:"topic"`
	Padding  hexutil.Bytes       `json:"padding"`
	Payload  hexutil.Bytes       `json:"payload"`
	WorkTime uint32              `json:"worktime"`
	PoW      float64             `json:"pow"`
	FilterID uint32              `json:"filterID"`
	PeerID   hexutil.Bytes       `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 hexutil.Bytes) 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) Start added in v1.5.8

func (api *PublicWhisperAPI) Start() error

Start starts the Whisper worker threads.

func (*PublicWhisperAPI) Stop added in v1.5.8

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.

func (*PublicWhisperAPI) Version

func (api *PublicWhisperAPI) Version() (hexutil.Uint, error)

Version returns the Whisper version this node offers.

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.

Jump to

Keyboard shortcuts

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