Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Waku

Hierarchy

  • Waku

Index

Constructors

Private constructor

Properties

libp2p

libp2p: Libp2p

lightPush

lightPush: WakuLightPush

Private pingKeepAliveTimers

pingKeepAliveTimers: {}

Type declaration

  • [peer: string]: ReturnType<typeof setInterval>

relay

relay: WakuRelay

Private relayKeepAliveTimers

relayKeepAliveTimers: {}

Type declaration

  • [peer: string]: ReturnType<typeof setInterval>

store

store: WakuStore

Methods

addDecryptionKey

  • addDecryptionKey(key: string | Uint8Array, options?: { contentTopics?: string[]; method?: DecryptionMethod }): void
  • Register a decryption key to attempt decryption of messages received via WakuRelay and WakuStore. This can either be a private key for asymmetric encryption or a symmetric key.

    Strings must be in hex format.

    Parameters

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

    Returns void

addPeerToAddressBook

  • addPeerToAddressBook(peerId: string | PeerId, multiaddrs: string[] | Multiaddr[]): void
  • Add peer to address book, it will be auto-dialed in the background.

    Parameters

    • peerId: string | PeerId
    • multiaddrs: string[] | Multiaddr[]

    Returns void

deleteDecryptionKey

  • deleteDecryptionKey(key: string | Uint8Array): void
  • Delete a decryption key that was used to attempt decryption of messages received via WakuRelay or WakuStore.

    Strings must be in hex format.

    Parameters

    • key: string | Uint8Array

    Returns void

dial

  • dial(peer: string | Multiaddr | PeerId): Promise<{ protocol: string; stream: MuxedStream }>
  • Dials to the provided peer.

    Parameters

    • peer: string | Multiaddr | PeerId

      The peer to dial

    Returns Promise<{ protocol: string; stream: MuxedStream }>

getLocalMultiaddrWithID

  • getLocalMultiaddrWithID(): string
  • Return the local multiaddr with peer id on which libp2p is listening.

    throws

    if libp2p is not listening on localhost

    Returns string

Private startKeepAlive

  • startKeepAlive(peerId: PeerId, pingPeriodSecs: number, relayPeriodSecs: number): void
  • Parameters

    • peerId: PeerId
    • pingPeriodSecs: number
    • relayPeriodSecs: number

    Returns void

stop

  • stop(): Promise<void>

Private stopKeepAlive

  • stopKeepAlive(peerId: PeerId): void

waitForConnectedPeer

  • waitForConnectedPeer(protocols?: string[][]): Promise<void>
  • Wait to be connected to a peer. Useful when using the CreateOptions.bootstrap with Waku.create. The Promise resolves only once we are connected to a Store peer, Relay peer and Light Push peer.

    Parameters

    • Optional protocols: string[][]

    Returns Promise<void>

Static create

Generated using TypeDoc