Versions in this module Expand all Collapse all v0 v0.4.1 Dec 28, 2018 v0.4.0 Oct 11, 2018 Changes in this version + const AESNonceLength + const DefaultMaxMessageSize + const DefaultMinimumPoW + const DefaultTTL + const EnvelopeVersion + const MaxMessageSize + const NumberOfMessageCodes + const ProtocolName + const ProtocolVersion + const ProtocolVersionStr + const SynchAllowance + 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 BytesToUintBigEndian(b []byte) (res uint64) + func GenerateRandomID() (id string, err error) + func IsPubKeyEqual(a, b *ecdsa.PublicKey) bool + func NewSentMessage(params *MessageParams) (*sentMessage, error) + func ValidatePublicKey(k *ecdsa.PublicKey) bool + type Config struct + MaxMessageSize uint32 + MinimumAcceptedPOW float64 + 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 + AESNonce []byte + Data []byte + EnvNonce uint64 + Expiry uint32 + TTL uint32 + Topic TopicType + Version []byte + func NewEnvelope(ttl uint32, topic TopicType, aesNonce []byte, msg *sentMessage) *Envelope + func (e *Envelope) DecodeRLP(s *rlp.Stream) error + func (e *Envelope) Hash() common.Hash + func (e *Envelope) IsSymmetric() bool + 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 + func (e *Envelope) Ver() uint64 + 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) MatchTopic(topic TopicType) 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) 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) MarkTrustedPeer(ctx context.Context, enode 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) (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 + EnvelopeVersion uint64 + Padding []byte + Payload []byte + PoW float64 + Raw []byte + Sent uint32 + Signature []byte + Src *ecdsa.PublicKey + SymKeyHash common.Hash + TTL uint32 + Topic TopicType + func (msg *ReceivedMessage) SigToPubKey() *ecdsa.PublicKey + func (msg *ReceivedMessage) Validate() 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) APIs() []rpc.API + func (w *Whisper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) + func (w *Whisper) AddSymKeyDirect(key []byte) (string, error) + func (w *Whisper) AddSymKeyFromPassword(password string) (string, error) + func (w *Whisper) AllowP2PMessagesFromPeer(peerID []byte) error + func (w *Whisper) DeleteKeyPair(key string) bool + func (w *Whisper) DeleteSymKey(id string) bool + func (w *Whisper) Envelopes() []*Envelope + func (w *Whisper) GenerateSymKey() (string, error) + func (w *Whisper) GetFilter(id string) *Filter + func (w *Whisper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) + func (w *Whisper) GetSymKey(id string) ([]byte, error) + func (w *Whisper) HandlePeer(peer *p2p.Peer, rw p2p.MsgReadWriter) error + func (w *Whisper) HasKeyPair(id string) bool + func (w *Whisper) HasSymKey(id string) bool + func (w *Whisper) MaxMessageSize() uint32 + func (w *Whisper) Messages(id string) []*ReceivedMessage + func (w *Whisper) MinPow() float64 + func (w *Whisper) NewKeyPair() (string, error) + func (w *Whisper) Overflow() bool + func (w *Whisper) Protocols() []p2p.Protocol + func (w *Whisper) RegisterServer(server MailServer) + func (w *Whisper) RequestHistoricMessages(peerID []byte, envelope *Envelope) error + func (w *Whisper) Send(envelope *Envelope) error + func (w *Whisper) SendP2PDirect(peer *Peer, envelope *Envelope) error + func (w *Whisper) SendP2PMessage(peerID []byte, envelope *Envelope) error + func (w *Whisper) SetMaxMessageSize(size uint32) error + func (w *Whisper) SetMinimumPoW(val float64) error + func (w *Whisper) Start(*p2p.Server) error + func (w *Whisper) Stats() Statistics + func (w *Whisper) Stop() error + func (w *Whisper) Subscribe(f *Filter) (string, error) + func (w *Whisper) Unsubscribe(id string) error + func (w *Whisper) Version() uint