Implements the Waku v2 Store protocol.

The Waku Store protocol can be used to retrieved historical messages.

Hierarchy

  • WakuStore

Constructors

Properties

decryptionKeys: Map<Uint8Array, { contentTopics?: string[]; method?: DecryptionMethod }>
libp2p: Libp2p
pubSubTopic: string

Methods

  • Register a decryption key to attempt decryption of messages received in any subsequent queryHistory call. This can either be a private key for asymmetric encryption or a symmetric key. WakuStore will attempt to decrypt messages using both methods.

    Strings must be in hex format.

    Parameters

    • key: string | Uint8Array
    • Optional options: { contentTopics?: string[]; method?: DecryptionMethod }

    Returns void

  • cursorV2Beta4 Delete a decryption key that was used to attempt decryption of messages received in subsequent queryHistory calls.

    Strings must be in hex format.

    Parameters

    • key: string | Uint8Array

    Returns void

  • Returns known peers from the address book (libp2p.peerStore) that support store protocol. Waku may or may not be currently connected to these peers.

    Returns Promise<Peer[]>

  • Do a query to a Waku Store to retrieve historical/missed messages.

    Throws

    If not able to reach a Waku Store peer to query or if an error is encountered when processing the reply.

    Parameters

    • contentTopics: string[]

      The content topics to pass to the query, leave empty to retrieve all messages.

    • Optional options: QueryOptions

      Optional parameters.

    Returns Promise<waku_message.WakuMessage[]>

  • Returns a random peer that supports store protocol from the address book (libp2p.peerStore). Waku may or may not be currently connected to this peer.

    Returns Promise<undefined | Peer>

Generated using TypeDoc