Documentation ¶
Index ¶
- Constants
- Variables
- func BloomFilterMatch(filter, sample []byte) bool
- func Bytes2Hex(d []byte) string
- func DecodeHex(input string) ([]byte, error)
- func EncodeHex(b []byte) string
- func EncodeHexes(bs [][]byte) []string
- func FromHex(s string) []byte
- func Hex2Bytes(str string) []byte
- func IsHexAddress(s string) bool
- func MakeFullNodeBloom() []byte
- func MustDecodeHex(input string) []byte
- func ToHex(bytes []byte) string
- func TopicToBloom(topic TopicType) []byte
- func TopicTypeToByteArray(t TopicType) []byte
- func UnmarshalFixedHexText(typname string, input, out []byte) error
- func UnmarshalFixedJSON(typ reflect.Type, input, out []byte) error
- func UnmarshalFixedText(typname string, input, out []byte) error
- func UnmarshalFixedUnprefixedText(typname string, input, out []byte) error
- type Account
- type Address
- func (a Address) Bytes() []byte
- func (a Address) Format(s fmt.State, c rune)
- func (a Address) Hash() Hash
- func (a Address) Hex() string
- func (a Address) ImplementsGraphQLType(name string) bool
- func (a Address) MarshalText() ([]byte, error)
- func (a *Address) Scan(src interface{}) error
- func (a *Address) SetBytes(b []byte)
- func (a Address) String() string
- func (a *Address) UnmarshalGraphQL(input interface{}) error
- func (a *Address) UnmarshalJSON(input []byte) error
- func (a *Address) UnmarshalText(input []byte) error
- func (a Address) Value() (driver.Value, error)
- type ConnStatus
- type ConnStatusSubscription
- type Criteria
- type EnodeID
- type Envelope
- type EnvelopeError
- type EnvelopeEvent
- type EventType
- type Filter
- type Hash
- type HexBytes
- type Key
- type KeyStore
- type MailServerResponse
- type Message
- type MessagesRequest
- type MixedcaseAddress
- func (ma *MixedcaseAddress) Address() Address
- func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)
- func (ma *MixedcaseAddress) Original() string
- func (ma *MixedcaseAddress) String() string
- func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error
- func (ma *MixedcaseAddress) ValidChecksum() bool
- type NegotiatedSecret
- type NewMessage
- type Node
- type PublicWakuAPI
- type PublicWhisperAPI
- type StatsSummary
- type StoreRequestCursor
- type Subscription
- type SubscriptionOptions
- type SyncEventResponse
- type SyncMailRequest
- type TopicType
- type UnprefixedAddress
- type Waku
- type WakuKeyManager
- type WakuV2Peer
- type Whisper
- type Wrapped
Constants ¶
const ( // PubKeyLength represents the length (in bytes) of an uncompressed public key PubKeyLength = 512 / 8 // AesKeyLength represents the length (in bytes) of an private key AesKeyLength = 256 / 8 )
const ( // EnvelopeTimeNotSynced represents the code passed to notify of a clock skew situation EnvelopeTimeNotSynced uint = 1000 // EnvelopeOtherError represents the code passed to notify of a generic error situation EnvelopeOtherError )
const ( // TopicLength is the expected length of the topic, in bytes TopicLength = 4 // BloomFilterSize is the expected length of a bloom filter byte array, in bytes BloomFilterSize = 64 )
const AddressLength = 20
AddressLength is the expected length of the address
const (
// HashLength is the expected length of the hash
HashLength = 32
)
const ( // MaxLimitInMessagesRequest represents the maximum number of messages // that can be requested from the mailserver MaxLimitInMessagesRequest = 1000 )
Variables ¶
var ( ErrEmptyString = &decError{"empty hex string"} ErrSyntax = &decError{"invalid hex string"} ErrMissingPrefix = &decError{"hex string without 0x prefix"} ErrOddLength = &decError{"hex string of odd length"} ErrEmptyNumber = &decError{"hex string \"0x\""} ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrUint64Range = &decError{"hex number > 64 bits"} ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} ErrBig256Range = &decError{"hex number > 256 bits"} )
Errors
Functions ¶
func BloomFilterMatch ¶
BloomFilterMatch returns true if a sample matches a bloom filter
func EncodeHexes ¶ added in v0.171.21
EncodeHex encodes bs as a hex strings with 0x prefix.
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func IsHexAddress ¶
IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.
func MakeFullNodeBloom ¶
func MakeFullNodeBloom() []byte
MakeFullNodeBloom returns a bloom filter which matches all topics
func MustDecodeHex ¶
MustDecodeHex decodes a hex string with 0x prefix. It panics for invalid input.
func TopicToBloom ¶
TopicToBloom converts the topic (4 bytes) to the bloom filter (64 bytes)
func TopicTypeToByteArray ¶ added in v0.98.1
func UnmarshalFixedHexText ¶
UnmarshalFixedHexText decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
func UnmarshalFixedJSON ¶
UnmarshalFixedJSON decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalJSON method for fixed-size types.
func UnmarshalFixedText ¶
UnmarshalFixedText decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
func UnmarshalFixedUnprefixedText ¶
UnmarshalFixedUnprefixedText decodes the input as a string with optional 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
Types ¶
type Account ¶
type Account struct { Address Address `json:"address"` // Ethereum account address derived from the key URL string `json:"url"` // Optional resource locator within a backend }
Account represents an Ethereum account located at a specific location defined by the optional URL field.
type Address ¶
type Address [AddressLength]byte
Address represents the 20 byte address of an Ethereum account.
func BigToAddress ¶
BigToAddress returns Address with byte values of b. If b is larger than len(h), b will be cropped from the left.
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
func (Address) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (Address) ImplementsGraphQLType ¶
ImplementsGraphQLType returns true if Hash implements the specified GraphQL type.
func (Address) MarshalText ¶
MarshalText returns the hex representation of a.
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (*Address) UnmarshalGraphQL ¶
UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Address) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
type ConnStatus ¶ added in v0.93.2
type ConnStatus struct { IsOnline bool `json:"isOnline"` HasHistory bool `json:"hasHistory"` Peers map[string]WakuV2Peer `json:"peers"` }
type ConnStatusSubscription ¶ added in v0.93.2
type ConnStatusSubscription struct { sync.RWMutex ID string C chan ConnStatus // contains filtered or unexported fields }
func NewConnStatusSubscription ¶ added in v0.93.2
func NewConnStatusSubscription() *ConnStatusSubscription
func (*ConnStatusSubscription) Active ¶ added in v0.93.2
func (u *ConnStatusSubscription) Active() bool
func (*ConnStatusSubscription) Send ¶ added in v0.175.3
func (u *ConnStatusSubscription) Send(s ConnStatus) bool
func (*ConnStatusSubscription) Unsubscribe ¶ added in v0.93.2
func (u *ConnStatusSubscription) Unsubscribe()
type Criteria ¶
type Criteria struct { SymKeyID string `json:"symKeyID"` PrivateKeyID string `json:"privateKeyID"` Sig []byte `json:"sig"` MinPow float64 `json:"minPow"` PubsubTopic string `json:"pubsubTopic"` Topics []TopicType `json:"topics"` AllowP2P bool `json:"allowP2P"` }
Criteria holds various filter options for inbound messages.
type Envelope ¶
type Envelope interface { Wrapped Hash() Hash // cached hash of the envelope to avoid rehashing every time Bloom() []byte PoW() float64 Expiry() uint32 TTL() uint32 Topic() TopicType Size() int }
Envelope represents a clear-text data packet to transmit through the Whisper network. Its contents may or may not be encrypted and signed.
type EnvelopeError ¶
EnvelopeError code and optional description of the error.
type EnvelopeEvent ¶
EnvelopeEvent used for envelopes events.
type EventType ¶
type EventType string
EventType used to define known envelope events.
const ( // EventEnvelopeSent fires when envelope was sent to a peer. EventEnvelopeSent EventType = "envelope.sent" // EventEnvelopeExpired fires when envelop expired EventEnvelopeExpired EventType = "envelope.expired" // EventEnvelopeReceived is sent once envelope was received from a peer. // EventEnvelopeReceived must be sent to the feed even if envelope was previously in the cache. // And event, ideally, should contain information about peer that sent envelope to us. EventEnvelopeReceived EventType = "envelope.received" // EventBatchAcknowledged is sent when batch of envelopes was acknowledged by a peer. EventBatchAcknowledged EventType = "batch.acknowledged" // EventEnvelopeAvailable fires when envelop is available for filters EventEnvelopeAvailable EventType = "envelope.available" // EventMailServerRequestSent fires when such request is sent. EventMailServerRequestSent EventType = "mailserver.request.sent" // EventMailServerRequestCompleted fires after mailserver sends all the requested messages EventMailServerRequestCompleted EventType = "mailserver.request.completed" // EventMailServerRequestExpired fires after mailserver the request TTL ends. // This event is independent and concurrent to EventMailServerRequestCompleted. // Request should be considered as expired only if expiry event was received first. EventMailServerRequestExpired EventType = "mailserver.request.expired" // EventMailServerEnvelopeArchived fires after an envelope has been archived EventMailServerEnvelopeArchived EventType = "mailserver.envelope.archived" // EventMailServerSyncFinished fires when the sync of messages is finished. EventMailServerSyncFinished EventType = "mailserver.sync.finished" )
NOTE: This list of event names is extracted from Geth. It must be kept in sync, or otherwise a mapping layer needs to be created
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
func HexToHash ¶
HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.
func (Hash) MarshalText ¶
MarshalText returns the hex representation of h.
func (*Hash) SetBytes ¶
SetBytes sets the hash to the value of b. If b is larger than len(h), b will be cropped from the left.
func (Hash) String ¶
String implements the stringer interface and is used also by the logger when doing full logging into a file.
func (*Hash) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Hash) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
type HexBytes ¶
type HexBytes []byte
HexBytes marshals/unmarshals as a JSON string with 0x prefix. The empty slice marshals as "0x".
func (HexBytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*HexBytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*HexBytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Key ¶
type Key struct { ID uuid.UUID // Version 4 "random" for unique id not derived from key data // to simplify lookups we also store the address Address Address // we only store privkey as pubkey/address can be derived from it // privkey in this struct is always in plaintext PrivateKey *ecdsa.PrivateKey // ExtendedKey is the extended key of the PrivateKey itself, and it's used // to derive child keys. ExtendedKey *extkeys.ExtendedKey // Deprecated: SubAccountIndex // It was use in Status to keep track of the number of sub-account created // before having multi-account support. SubAccountIndex uint32 }
type KeyStore ¶
type KeyStore interface { // ImportAccount imports the account specified with privateKey. ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (Account, error) // ImportSingleExtendedKey imports an extended key setting it in both the PrivateKey and ExtendedKey fields // of the Key struct. // ImportExtendedKey is used in older version of Status where PrivateKey is set to be the BIP44 key at index 0, // and ExtendedKey is the extended key of the BIP44 key at index 1. ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, passphrase string) (Account, error) // ImportExtendedKeyForPurpose stores ECDSA key (obtained from extended key) along with CKD#2 (root for sub-accounts) // If key file is not found, it is created. Key is encrypted with the given passphrase. // Deprecated: status-go is now using ImportSingleExtendedKey ImportExtendedKeyForPurpose(keyPurpose extkeys.KeyPurpose, extKey *extkeys.ExtendedKey, passphrase string) (Account, error) // AccountDecryptedKey returns decrypted key for account (provided that password is correct). AccountDecryptedKey(a Account, auth string) (Account, *Key, error) // Delete deletes the key matched by account if the passphrase is correct. // If the account contains no filename, the address must match a unique key. Delete(a Account) error }
type MailServerResponse ¶
MailServerResponse is the response payload sent by the mailserver.
type Message ¶
type Message struct { Sig []byte `json:"sig,omitempty"` TTL uint32 `json:"ttl"` Timestamp uint32 `json:"timestamp"` PubsubTopic string `json:"pubsubTopic"` Topic TopicType `json:"topic"` Payload []byte `json:"payload"` Padding []byte `json:"padding"` PoW float64 `json:"pow"` Hash []byte `json:"hash"` Dst []byte `json:"recipientPublicKey,omitempty"` P2P bool `json:"bool,omitempty"` ThirdPartyID string `json:"thirdPartyId,omitempty"` }
Message is the RPC representation of a whisper message.
type MessagesRequest ¶
type MessagesRequest struct { // ID of the request. The current implementation requires ID to be 32-byte array, // however, it's not enforced for future implementation. ID []byte `json:"id"` // From is a lower bound of time range. From uint32 `json:"from"` // To is a upper bound of time range. To uint32 `json:"to"` // Limit determines the number of messages sent by the mail server // for the current paginated request. Limit uint32 `json:"limit"` // Cursor is used as starting point for paginated requests. Cursor []byte `json:"cursor"` // StoreCursor is used as starting point for WAKUV2 paginatedRequests StoreCursor *StoreRequestCursor `json:"storeCursor"` // Bloom is a filter to match requested messages. Bloom []byte `json:"bloom"` // PubsubTopic is the gossipsub topic on which the message was broadcasted PubsubTopic string `json:"pubsubTopic"` // ContentTopics is a list of topics. A returned message should // belong to one of the topics from the list. ContentTopics [][]byte `json:"contentTopics"` }
MessagesRequest contains details of a request of historic messages.
func (*MessagesRequest) SetDefaults ¶
func (r *MessagesRequest) SetDefaults(now time.Time)
SetDefaults sets the From and To defaults
type MixedcaseAddress ¶
type MixedcaseAddress struct {
// contains filtered or unexported fields
}
MixedcaseAddress retains the original string, which may or may not be correctly checksummed
func NewMixedcaseAddress ¶
func NewMixedcaseAddress(addr Address) MixedcaseAddress
NewMixedcaseAddress constructor (mainly for testing)
func NewMixedcaseAddressFromString ¶
func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error)
NewMixedcaseAddressFromString is mainly meant for unit-testing
func (*MixedcaseAddress) Address ¶
func (ma *MixedcaseAddress) Address() Address
Address returns the address
func (*MixedcaseAddress) MarshalJSON ¶
func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)
MarshalJSON marshals the original value
func (*MixedcaseAddress) Original ¶
func (ma *MixedcaseAddress) Original() string
Original returns the mixed-case input string
func (*MixedcaseAddress) String ¶
func (ma *MixedcaseAddress) String() string
String implements fmt.Stringer
func (*MixedcaseAddress) UnmarshalJSON ¶
func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error
UnmarshalJSON parses MixedcaseAddress
func (*MixedcaseAddress) ValidChecksum ¶
func (ma *MixedcaseAddress) ValidChecksum() bool
ValidChecksum returns true if the address has valid checksum
type NegotiatedSecret ¶
NegotiatedSecret represents a negotiated secret (both public and private keys)
type NewMessage ¶
type NewMessage struct { SymKeyID string `json:"symKeyID"` PublicKey []byte `json:"pubKey"` SigID string `json:"sig"` TTL uint32 `json:"ttl"` PubsubTopic string `json:"pubsubTopic"` Topic TopicType `json:"topic"` Payload []byte `json:"payload"` Padding []byte `json:"padding"` PowTime uint32 `json:"powTime"` PowTarget float64 `json:"powTarget"` TargetPeer string `json:"targetPeer"` Ephemeral bool `json:"ephemeral"` }
NewMessage represents a new whisper message that is posted through the RPC.
type PublicWakuAPI ¶
type PublicWakuAPI interface { // AddPrivateKey imports the given private key. AddPrivateKey(ctx context.Context, privateKey HexBytes) (string, error) // GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID. GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) // DeleteKeyPair removes the key with the given key if it exists. DeleteKeyPair(ctx context.Context, key string) (bool, error) // Post posts a message on the Whisper network. // returns the hash of the message in case of success. Post(ctx context.Context, req NewMessage) ([]byte, error) // NewMessageFilter creates a new filter that can be used to poll for // (new) messages that satisfy the given criteria. NewMessageFilter(req Criteria) (string, error) // GetFilterMessages returns the messages that match the filter criteria and // are received between the last poll and now. GetFilterMessages(id string) ([]*Message, error) BloomFilter() []byte }
PublicWakuAPI provides the waku RPC service that can be use publicly without security implications.
type PublicWhisperAPI ¶
type PublicWhisperAPI interface { // AddPrivateKey imports the given private key. AddPrivateKey(ctx context.Context, privateKey HexBytes) (string, error) // GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID. GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) // DeleteKeyPair removes the key with the given key if it exists. DeleteKeyPair(ctx context.Context, key string) (bool, error) // Post posts a message on the Whisper network. // returns the hash of the message in case of success. Post(ctx context.Context, req NewMessage) ([]byte, error) // NewMessageFilter creates a new filter that can be used to poll for // (new) messages that satisfy the given criteria. NewMessageFilter(req Criteria) (string, error) // GetFilterMessages returns the messages that match the filter criteria and // are received between the last poll and now. GetFilterMessages(id string) ([]*Message, error) // BloomFilter returns the current bloomfilter of the node BloomFilter() []byte }
PublicWhisperAPI provides the whisper RPC service that can be use publicly without security implications.
type StatsSummary ¶ added in v0.83.8
type StoreRequestCursor ¶ added in v0.83.2
type Subscription ¶
type Subscription interface { Err() <-chan error // returns the error channel Unsubscribe() // cancels sending of events, closing the error channel }
Subscription represents a stream of events. The carrier of the events is typically a channel, but isn't part of the interface.
Subscriptions can fail while established. Failures are reported through an error channel. It receives a value if there is an issue with the subscription (e.g. the network connection delivering the events has been closed). Only one value will ever be sent.
The error channel is closed when the subscription ends successfully (i.e. when the source of events is closed). It is also closed when Unsubscribe is called.
The Unsubscribe method cancels the sending of events. You must call Unsubscribe in all cases to ensure that resources related to the subscription are released. It can be called any number of times.
type SubscriptionOptions ¶
type SubscriptionOptions struct { PrivateKeyID string SymKeyID string PoW float64 PubsubTopic string Topics [][]byte }
SubscriptionOptions represents the parameters passed to Subscribe() to customize the subscription behavior.
type SyncEventResponse ¶
SyncEventResponse is a response from the Mail Server form which the peer received envelopes.
type SyncMailRequest ¶
type SyncMailRequest struct { // Lower is a lower bound of time range for which messages are requested. Lower uint32 // Upper is a lower bound of time range for which messages are requested. Upper uint32 // Bloom is a bloom filter to filter envelopes. Bloom []byte // Limit is the max number of envelopes to return. Limit uint32 // Cursor is used for pagination of the results. Cursor []byte }
SyncMailRequest contains details which envelopes should be synced between Mail Servers.
type TopicType ¶
type TopicType [TopicLength]byte
TopicType represents a cryptographically secure, probabilistic partial classifications of a message, determined as the first (left) 4 bytes of the SHA3 hash of some arbitrary data given by the original author of the message.
func BytesToTopic ¶
BytesToTopic converts from the byte array representation of a topic into the TopicType type.
func StringToTopic ¶ added in v0.98.1
func (TopicType) MarshalText ¶
MarshalText returns the hex representation of t.
func (*TopicType) UnmarshalText ¶
UnmarshalText parses a hex representation to a topic.
type UnprefixedAddress ¶
type UnprefixedAddress Address
UnprefixedAddress allows marshaling an Address without 0x prefix.
func (UnprefixedAddress) MarshalText ¶
func (a UnprefixedAddress) MarshalText() ([]byte, error)
MarshalText encodes the address as hex.
func (*UnprefixedAddress) UnmarshalText ¶
func (a *UnprefixedAddress) UnmarshalText(input []byte) error
UnmarshalText decodes the address from hex. The 0x prefix is optional.
type Waku ¶
type Waku interface { PublicWakuAPI() PublicWakuAPI // Waku protocol version Version() uint // PeerCount PeerCount() int ListenAddresses() ([]string, error) ENR() (string, error) Peers() map[string]WakuV2Peer StartDiscV5() error StopDiscV5() error SubscribeToPubsubTopic(topic string, optPublicKey *ecdsa.PublicKey) error UnsubscribeFromPubsubTopic(topic string) error StorePubsubTopicKey(topic string, privKey *ecdsa.PrivateKey) error RetrievePubsubTopicKey(topic string) (*ecdsa.PrivateKey, error) RemovePubsubTopicKey(topic string) error AddStorePeer(address string) (peer.ID, error) AddRelayPeer(address string) (peer.ID, error) DialPeer(address string) error DialPeerByID(peerID string) error DropPeer(peerID string) error SubscribeToConnStatusChanges() (*ConnStatusSubscription, error) SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []string) error // MinPow returns the PoW value required by this node. MinPow() float64 // BloomFilter returns the aggregated bloom filter for all the topics of interest. // The nodes are required to send only messages that match the advertised bloom filter. // If a message does not match the bloom, it will tantamount to spam, and the peer will // be disconnected. BloomFilter() []byte // GetCurrentTime returns current time. GetCurrentTime() time.Time // GetPrivateKey retrieves the private key of the specified identity. GetPrivateKey(id string) (*ecdsa.PrivateKey, error) SubscribeEnvelopeEvents(events chan<- EnvelopeEvent) Subscription // AddKeyPair imports a asymmetric private key and returns a deterministic identifier. AddKeyPair(key *ecdsa.PrivateKey) (string, error) // DeleteKeyPair deletes the key with the specified ID if it exists. DeleteKeyPair(keyID string) bool AddSymKeyDirect(key []byte) (string, error) AddSymKeyFromPassword(password string) (string, error) DeleteSymKey(id string) bool GetSymKey(id string) ([]byte, error) MaxMessageSize() uint32 GetStats() StatsSummary Subscribe(opts *SubscriptionOptions) (string, error) GetFilter(id string) Filter Unsubscribe(ctx context.Context, id string) error UnsubscribeMany(ids []string) error // RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, // which is known to implement MailServer interface, and is supposed to process this // request and respond with a number of peer-to-peer messages (possibly expired), // which are not supposed to be forwarded any further. // The whisper protocol is agnostic of the format and contents of envelope. // A timeout of 0 never expires. RequestHistoricMessagesWithTimeout(peerID []byte, envelope Envelope, timeout time.Duration) error // SendMessagesRequest sends a MessagesRequest. This is an equivalent to RequestHistoricMessages // in terms of the functionality. SendMessagesRequest(peerID []byte, request MessagesRequest) error // RequestStoreMessages uses the WAKU2-STORE protocol to request historic messages RequestStoreMessages(ctx context.Context, peerID []byte, request MessagesRequest, processEnvelopes bool) (*StoreRequestCursor, int, error) // ProcessingP2PMessages indicates whether there are in-flight p2p messages ProcessingP2PMessages() bool // MarkP2PMessageAsProcessed tells the waku layer that a P2P message has been processed MarkP2PMessageAsProcessed(common.Hash) // ConnectionChanged is called whenever the client knows its connection status has changed ConnectionChanged(connection.State) // ClearEnvelopesCache clears waku envelopes cache ClearEnvelopesCache() // ConfirmMessageDelivered updates a message has been delivered in waku ConfirmMessageDelivered(hash []common.Hash) // SetStorePeerID updates the peer id of store node SetStorePeerID(peerID peer.ID) }
Whisper represents a dark communication interface through the Ethereum network, using its very own P2P communication layer.
type WakuKeyManager ¶ added in v0.94.12
type WakuKeyManager interface { // GetPrivateKey retrieves the private key of the specified identity. GetPrivateKey(id string) (*ecdsa.PrivateKey, error) // AddKeyPair imports a asymmetric private key and returns a deterministic identifier. AddKeyPair(key *ecdsa.PrivateKey) (string, error) // DeleteKeyPair deletes the key with the specified ID if it exists. DeleteKeyPair(keyID string) bool // DeleteKeyPairs deletes all the keys DeleteKeyPairs() error AddSymKeyDirect(key []byte) (string, error) AddSymKeyFromPassword(password string) (string, error) DeleteSymKey(id string) bool GetSymKey(id string) ([]byte, error) }
type WakuV2Peer ¶ added in v0.115.4
type Whisper ¶
type Whisper interface { PublicWhisperAPI() PublicWhisperAPI // MinPow returns the PoW value required by this node. MinPow() float64 // BloomFilter returns the aggregated bloom filter for all the topics of interest. // The nodes are required to send only messages that match the advertised bloom filter. // If a message does not match the bloom, it will tantamount to spam, and the peer will // be disconnected. BloomFilter() []byte // SetTimeSource assigns a particular source of time to a whisper object. SetTimeSource(timesource func() time.Time) // GetCurrentTime returns current time. GetCurrentTime() time.Time MaxMessageSize() uint32 // GetPrivateKey retrieves the private key of the specified identity. GetPrivateKey(id string) (*ecdsa.PrivateKey, error) SubscribeEnvelopeEvents(events chan<- EnvelopeEvent) Subscription // AddKeyPair imports a asymmetric private key and returns a deterministic identifier. AddKeyPair(key *ecdsa.PrivateKey) (string, error) // DeleteKeyPair deletes the key with the specified ID if it exists. DeleteKeyPair(keyID string) bool // DeleteKeyPairs removes all cryptographic identities known to the node DeleteKeyPairs() error AddSymKeyDirect(key []byte) (string, error) AddSymKeyFromPassword(password string) (string, error) DeleteSymKey(id string) bool GetSymKey(id string) ([]byte, error) Subscribe(opts *SubscriptionOptions) (string, error) GetFilter(id string) Filter Unsubscribe(id string) error UnsubscribeMany(ids []string) error // RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, // which is known to implement MailServer interface, and is supposed to process this // request and respond with a number of peer-to-peer messages (possibly expired), // which are not supposed to be forwarded any further. // The whisper protocol is agnostic of the format and contents of envelope. // A timeout of 0 never expires. RequestHistoricMessagesWithTimeout(peerID []byte, envelope Envelope, timeout time.Duration) error // SendMessagesRequest sends a MessagesRequest. This is an equivalent to RequestHistoricMessages // in terms of the functionality. SendMessagesRequest(peerID []byte, request MessagesRequest) error // SyncMessages can be sent between two Mail Servers and syncs envelopes between them. SyncMessages(peerID []byte, req SyncMailRequest) error }
Whisper represents a dark communication interface through the Ethereum network, using its very own P2P communication layer.