Versions in this module Expand all Collapse all v1 v1.9.2 Aug 23, 2019 v1.9.0 Jul 31, 2019 Changes in this version + const BloomFilterSize + const DefaultMaxMessageSize + const DefaultMinimumPoW + const DefaultSyncAllowance + const DefaultTTL + const EnvelopeHeaderLength + const MaxMessageSize + const NumberOfMessageCodes + const ProtocolName + const ProtocolVersion + const ProtocolVersionStr + const SizeMask + const TopicLength + var DefaultConfig = Config + var ErrInvalidPublicKey = errors.New("invalid public key") + var ErrInvalidSigningPubKey = errors.New("invalid signing public key") + var ErrInvalidSymmetricKey = errors.New("invalid symmetric key") + var ErrNoTopics = errors.New("missing topic(s)") + var ErrSymAsym = errors.New("specify either a symmetric or an asymmetric key") + var ErrTooLowPoW = errors.New("message rejected, PoW too low") + func BloomFilterMatch(filter, sample []byte) bool + func BytesToUintBigEndian(b []byte) (res uint64) + func GenerateRandomID() (id string, err error) + func IsPubKeyEqual(a, b *ecdsa.PublicKey) bool + func MakeFullNodeBloom() []byte + func NewSentMessage(params *MessageParams) (*sentMessage, error) + func TopicToBloom(topic TopicType) []byte + func ValidatePublicKey(k *ecdsa.PublicKey) bool + type Config struct + MaxMessageSize uint32 + MinimumAcceptedPOW float64 + RestrictConnectionBetweenLightClients bool + type Criteria struct + AllowP2P bool + MinPow float64 + PrivateKeyID string + Sig []byte + SymKeyID string + Topics []TopicType + func (c *Criteria) UnmarshalJSON(input []byte) error + func (c Criteria) MarshalJSON() ([]byte, error) + type Envelope struct + Data []byte + Expiry uint32 + Nonce uint64 + TTL uint32 + Topic TopicType + func NewEnvelope(ttl uint32, topic TopicType, msg *sentMessage) *Envelope + func (e *Envelope) Bloom() []byte + func (e *Envelope) DecodeRLP(s *rlp.Stream) error + func (e *Envelope) Hash() common.Hash + func (e *Envelope) Open(watcher *Filter) (msg *ReceivedMessage) + func (e *Envelope) OpenAsymmetric(key *ecdsa.PrivateKey) (*ReceivedMessage, error) + func (e *Envelope) OpenSymmetric(key []byte) (msg *ReceivedMessage, err error) + func (e *Envelope) PoW() float64 + func (e *Envelope) Seal(options *MessageParams) error + type Filter struct + AllowP2P bool + KeyAsym *ecdsa.PrivateKey + KeySym []byte + Messages map[common.Hash]*ReceivedMessage + PoW float64 + Src *ecdsa.PublicKey + SymKeyHash common.Hash + Topics [][]byte + func (f *Filter) MatchEnvelope(envelope *Envelope) bool + func (f *Filter) MatchMessage(msg *ReceivedMessage) bool + func (f *Filter) Retrieve() (all []*ReceivedMessage) + func (f *Filter) Trigger(msg *ReceivedMessage) + type Filters struct + func NewFilters(w *Whisper) *Filters + func (fs *Filters) Get(id string) *Filter + func (fs *Filters) Install(watcher *Filter) (string, error) + func (fs *Filters) NotifyWatchers(env *Envelope, p2pMessage bool) + func (fs *Filters) Uninstall(id string) bool + type Info struct + MaxMessageSize uint32 + Memory int + Messages int + MinPow float64 + type MailServer interface + Archive func(env *Envelope) + DeliverMail func(whisperPeer *Peer, request *Envelope) + type Message struct + Dst []byte + Hash []byte + Padding []byte + Payload []byte + PoW float64 + Sig []byte + TTL uint32 + Timestamp uint32 + Topic TopicType + func ToWhisperMessage(message *ReceivedMessage) *Message + func (m *Message) UnmarshalJSON(input []byte) error + func (m Message) MarshalJSON() ([]byte, error) + type MessageParams struct + Dst *ecdsa.PublicKey + KeySym []byte + Padding []byte + Payload []byte + PoW float64 + Src *ecdsa.PrivateKey + TTL uint32 + Topic TopicType + WorkTime uint32 + type NewMessage struct + Padding []byte + Payload []byte + PowTarget float64 + PowTime uint32 + PublicKey []byte + Sig string + SymKeyID string + TTL uint32 + TargetPeer string + Topic TopicType + func (n *NewMessage) UnmarshalJSON(input []byte) error + func (n NewMessage) MarshalJSON() ([]byte, error) + type Peer struct + func (peer *Peer) ID() []byte + type PublicWhisperAPI struct + func NewPublicWhisperAPI(w *Whisper) *PublicWhisperAPI + func (api *PublicWhisperAPI) AddPrivateKey(ctx context.Context, privateKey hexutil.Bytes) (string, error) + func (api *PublicWhisperAPI) AddSymKey(ctx context.Context, key hexutil.Bytes) (string, error) + func (api *PublicWhisperAPI) CancelLightClient(ctx context.Context) bool + func (api *PublicWhisperAPI) DeleteKeyPair(ctx context.Context, key string) (bool, error) + func (api *PublicWhisperAPI) DeleteMessageFilter(id string) (bool, error) + func (api *PublicWhisperAPI) DeleteSymKey(ctx context.Context, id string) bool + func (api *PublicWhisperAPI) GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) + func (api *PublicWhisperAPI) GetFilterMessages(id string) ([]*Message, error) + func (api *PublicWhisperAPI) GetPrivateKey(ctx context.Context, id string) (hexutil.Bytes, error) + func (api *PublicWhisperAPI) GetPublicKey(ctx context.Context, id string) (hexutil.Bytes, error) + func (api *PublicWhisperAPI) GetSymKey(ctx context.Context, id string) (hexutil.Bytes, error) + func (api *PublicWhisperAPI) HasKeyPair(ctx context.Context, id string) bool + func (api *PublicWhisperAPI) HasSymKey(ctx context.Context, id string) bool + func (api *PublicWhisperAPI) Info(ctx context.Context) Info + func (api *PublicWhisperAPI) MakeLightClient(ctx context.Context) bool + func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, url string) (bool, error) + func (api *PublicWhisperAPI) Messages(ctx context.Context, crit Criteria) (*rpc.Subscription, error) + func (api *PublicWhisperAPI) NewKeyPair(ctx context.Context) (string, error) + func (api *PublicWhisperAPI) NewMessageFilter(req Criteria) (string, error) + func (api *PublicWhisperAPI) NewSymKey(ctx context.Context) (string, error) + func (api *PublicWhisperAPI) Post(ctx context.Context, req NewMessage) (hexutil.Bytes, error) + func (api *PublicWhisperAPI) SetBloomFilter(ctx context.Context, bloom hexutil.Bytes) (bool, error) + func (api *PublicWhisperAPI) SetMaxMessageSize(ctx context.Context, size uint32) (bool, error) + func (api *PublicWhisperAPI) SetMinPoW(ctx context.Context, pow float64) (bool, error) + func (api *PublicWhisperAPI) Version(ctx context.Context) string + type ReceivedMessage struct + Dst *ecdsa.PublicKey + EnvelopeHash common.Hash + Padding []byte + Payload []byte + PoW float64 + Raw []byte + Salt []byte + Sent uint32 + Signature []byte + Src *ecdsa.PublicKey + SymKeyHash common.Hash + TTL uint32 + Topic TopicType + func (msg *ReceivedMessage) SigToPubKey() *ecdsa.PublicKey + func (msg *ReceivedMessage) ValidateAndParse() bool + type Statistics struct + type TopicType [TopicLength]byte + func BytesToTopic(b []byte) (t TopicType) + func (t *TopicType) String() string + func (t *TopicType) UnmarshalText(input []byte) error + func (t TopicType) MarshalText() ([]byte, error) + type Whisper struct + func New(cfg *Config) *Whisper + func (w *Whisper) GetEnvelope(hash common.Hash) *Envelope + func (whisper *Whisper) APIs() []rpc.API + func (whisper *Whisper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) + func (whisper *Whisper) AddSymKeyDirect(key []byte) (string, error) + func (whisper *Whisper) AddSymKeyFromPassword(password string) (string, error) + func (whisper *Whisper) AllowP2PMessagesFromPeer(peerID []byte) error + func (whisper *Whisper) BloomFilter() []byte + func (whisper *Whisper) BloomFilterTolerance() []byte + func (whisper *Whisper) DeleteKeyPair(key string) bool + func (whisper *Whisper) DeleteSymKey(id string) bool + func (whisper *Whisper) Envelopes() []*Envelope + func (whisper *Whisper) GenerateSymKey() (string, error) + func (whisper *Whisper) GetFilter(id string) *Filter + func (whisper *Whisper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) + func (whisper *Whisper) GetSymKey(id string) ([]byte, error) + func (whisper *Whisper) HandlePeer(peer *p2p.Peer, rw p2p.MsgReadWriter) error + func (whisper *Whisper) HasKeyPair(id string) bool + func (whisper *Whisper) HasSymKey(id string) bool + func (whisper *Whisper) LightClientMode() bool + func (whisper *Whisper) LightClientModeConnectionRestricted() bool + func (whisper *Whisper) MaxMessageSize() uint32 + func (whisper *Whisper) MinPow() float64 + func (whisper *Whisper) MinPowTolerance() float64 + func (whisper *Whisper) NewKeyPair() (string, error) + func (whisper *Whisper) Overflow() bool + func (whisper *Whisper) Protocols() []p2p.Protocol + func (whisper *Whisper) RegisterServer(server MailServer) + func (whisper *Whisper) RequestHistoricMessages(peerID []byte, envelope *Envelope) error + func (whisper *Whisper) Send(envelope *Envelope) error + func (whisper *Whisper) SendP2PDirect(peer *Peer, envelope *Envelope) error + func (whisper *Whisper) SendP2PMessage(peerID []byte, envelope *Envelope) error + func (whisper *Whisper) SetBloomFilter(bloom []byte) error + func (whisper *Whisper) SetLightClientMode(v bool) + func (whisper *Whisper) SetMaxMessageSize(size uint32) error + func (whisper *Whisper) SetMinimumPoW(val float64) error + func (whisper *Whisper) SetMinimumPowTest(val float64) + func (whisper *Whisper) Start(*p2p.Server) error + func (whisper *Whisper) Stats() Statistics + func (whisper *Whisper) Stop() error + func (whisper *Whisper) Subscribe(f *Filter) (string, error) + func (whisper *Whisper) Unsubscribe(id string) error + func (whisper *Whisper) Version() uint