Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Waku

Hierarchy

  • Waku

Index

Constructors

Properties

libp2p: Libp2p
lightPush: WakuLightPush
pingKeepAliveTimers: {}

Type declaration

  • [peer: string]: ReturnType<typeof setInterval>
relay: WakuRelay
relayKeepAliveTimers: {}

Type declaration

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

Methods

  • 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(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(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(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(): string
  • Return the local multiaddr with peer id on which libp2p is listening.

    throws

    if libp2p is not listening on localhost

    Returns string

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

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

    Returns void

  • stop(): Promise<void>
  • stopKeepAlive(peerId: PeerId): void
  • 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>

Generated using TypeDoc