go-ethereum: github.com/ethereum/go-ethereum/whisper/shhclient Index | Files

package shhclient

import "github.com/ethereum/go-ethereum/whisper/shhclient"

Index

Package Files

client.go

type Client Uses

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

Client defines typed wrappers for the Whisper v6 RPC API.

func Dial Uses

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

Dial connects a client to the given URL.

func NewClient Uses

func NewClient(c *rpc.Client) *Client

NewClient creates a client that uses the given RPC client.

func (*Client) AddPrivateKey Uses

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

AddPrivateKey stored the key pair, and returns its ID.

func (*Client) AddSymmetricKey Uses

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

AddSymmetricKey stores the key, and returns its identifier.

func (*Client) DeleteKeyPair Uses

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

DeleteKeyPair delete the specifies key.

func (*Client) DeleteMessageFilter Uses

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

DeleteMessageFilter removes the filter associated with the given id.

func (*Client) DeleteSymmetricKey Uses

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

DeleteSymmetricKey deletes the symmetric key associated with the given identifier.

func (*Client) FilterMessages Uses

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 Uses

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 Uses

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

GetSymmetricKey returns the symmetric key associated with the given identifier.

func (*Client) HasKeyPair Uses

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 Uses

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 Uses

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

Info returns diagnostic information about the whisper node.

func (*Client) MarkTrustedPeer Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Post a message onto the network.

func (*Client) PrivateKey Uses

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

PrivateKey return the private key for a key ID.

func (*Client) PublicKey Uses

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

PublicKey return the public key for a key ID.

func (*Client) SetMaxMessageSize Uses

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 Uses

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 Uses

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 Uses

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

Version returns the Whisper sub-protocol version.

Package shhclient imports 5 packages (graph) and is imported by 42 packages. Updated 2020-05-27. Refresh now. Tools for package owners.