shhclient

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client defines typed wrappers for the Whisper v6 RPC API.

func Dial

func Dial(rawurl string) (*Client, error)

Dial connects a client to the given URL.

func NewClient

func NewClient(c *rpc.Client) *Client

NewClient creates a client that uses the given RPC client.

func (*Client) AddPrivateKey

func (sc *Client) AddPrivateKey(ctx context.Context, key []byte) (string, error)

AddPrivateKey stored the key pair, and returns its ID.

func (*Client) AddSymmetricKey

func (sc *Client) AddSymmetricKey(ctx context.Context, key []byte) (string, error)

AddSymmetricKey stores the key, and returns its identifier.

func (*Client) DeleteKeyPair

func (sc *Client) DeleteKeyPair(ctx context.Context, id string) (string, error)

DeleteKeyPair delete the specifies key.

func (*Client) DeleteMessageFilter

func (sc *Client) DeleteMessageFilter(ctx context.Context, id string) error

DeleteMessageFilter removes the filter associated with the given id.

func (*Client) DeleteSymmetricKey

func (sc *Client) DeleteSymmetricKey(ctx context.Context, id string) error

DeleteSymmetricKey deletes the symmetric key associated with the given identifier.

func (*Client) FilterMessages

func (sc *Client) FilterMessages(ctx context.Context, id string) ([]*whisper.Message, error)

FilterMessages retrieves all messages that are received between the last call to this function and match the criteria that where given when the filter was created.

func (*Client) GenerateSymmetricKeyFromPassword

func (sc *Client) GenerateSymmetricKeyFromPassword(ctx context.Context, passwd string) (string, error)

GenerateSymmetricKeyFromPassword generates the key from password, stores it, and returns its identifier.

func (*Client) GetSymmetricKey

func (sc *Client) GetSymmetricKey(ctx context.Context, id string) ([]byte, error)

GetSymmetricKey returns the symmetric key associated with the given identifier.

func (*Client) HasKeyPair

func (sc *Client) HasKeyPair(ctx context.Context, id string) (bool, error)

HasKeyPair returns an indication if the node has a private key or key pair matching the given ID.

func (*Client) HasSymmetricKey

func (sc *Client) HasSymmetricKey(ctx context.Context, id string) (bool, error)

HasSymmetricKey returns an indication if the key associated with the given id is stored in the node.

func (*Client) Info

func (sc *Client) Info(ctx context.Context) (whisper.Info, error)

Info returns diagnostic information about the whisper node.

func (*Client) MarkTrustedPeer

func (sc *Client) MarkTrustedPeer(ctx context.Context, enode string) error

MarkTrustedPeer marks specific peer trusted, which will allow it to send historic (expired) messages. Note This function is not adding new nodes, the node needs to exists as a peer.

func (*Client) NewKeyPair

func (sc *Client) NewKeyPair(ctx context.Context) (string, error)

NewKeyPair generates a new public and private key pair for message decryption and encryption. It returns an identifier that can be used to refer to the key.

func (*Client) NewMessageFilter

func (sc *Client) NewMessageFilter(ctx context.Context, criteria whisper.Criteria) (string, error)

NewMessageFilter creates a filter within the node. This filter can be used to poll for new messages (see FilterMessages) that satisfy the given criteria. A filter can timeout when it was polled for in whisper.filterTimeout.

func (*Client) NewSymmetricKey

func (sc *Client) NewSymmetricKey(ctx context.Context) (string, error)

NewSymmetricKey generates a random symmetric key and returns its identifier. Can be used encrypting and decrypting messages where the key is known to both parties.

func (*Client) Post

func (sc *Client) Post(ctx context.Context, message whisper.NewMessage) (string, error)

Post a message onto the network.

func (*Client) PrivateKey

func (sc *Client) PrivateKey(ctx context.Context, id string) ([]byte, error)

PrivateKey return the private key for a key ID.

func (*Client) PublicKey

func (sc *Client) PublicKey(ctx context.Context, id string) ([]byte, error)

PublicKey return the public key for a key ID.

func (*Client) SetMaxMessageSize

func (sc *Client) SetMaxMessageSize(ctx context.Context, size uint32) error

SetMaxMessageSize sets the maximal message size allowed by this node. Incoming and outgoing messages with a larger size will be rejected. Whisper message size can never exceed the limit imposed by the underlying P2P protocol (10 Mb).

func (*Client) SetMinimumPoW

func (sc *Client) SetMinimumPoW(ctx context.Context, pow float64) error

SetMinimumPoW (experimental) sets the minimal PoW required by this node. This experimental function was introduced for the future dynamic adjustment of PoW requirement. If the node is overwhelmed with messages, it should raise the PoW requirement and notify the peers. The new value should be set relative to the old value (e.g. double). The old value could be obtained via shh_info call.

func (*Client) SubscribeMessages

func (sc *Client) SubscribeMessages(ctx context.Context, criteria whisper.Criteria, ch chan<- *whisper.Message) (ethereum.Subscription, error)

SubscribeMessages subscribes to messages that match the given criteria. This method is only supported on bi-directional connections such as websockets and IPC. NewMessageFilter uses polling and is supported over HTTP.

func (*Client) Version

func (sc *Client) Version(ctx context.Context) (string, error)

Version returns the Whisper sub-protocol version.

Jump to

Keyboard shortcuts

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