Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Waku

Hierarchy

  • Waku

Index

Constructors

Properties

filter: WakuFilter
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: Multiaddr[] | string[]): void
  • Add peer to address book, it will be auto-dialed in the background.

    Parameters

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

    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, protocols?: Protocols[]): Promise<{ protocol: string; stream: MuxedStream }>
  • Dials to the provided peer.

    Parameters

    • peer: string | Multiaddr | PeerId

      The peer to dial

    • Optional protocols: Protocols[]

      Waku protocols we expect from the peer; Default to Relay

    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>
  • stopAllKeepAlives(): void
  • stopKeepAlive(peerId: PeerId): void
  • waitForRemotePeer(protocols?: Protocols[], timeoutMs?: number): Promise<void>
  • Wait for a remote peer to be ready given the passed protocols. Useful when using the CreateOptions.bootstrap with Waku.create.

    default

    Remote peer must have Waku Relay enabled and no time out is applied.

    Parameters

    • Optional protocols: Protocols[]

      The protocols that need to be enabled by remote peers.

    • Optional timeoutMs: number

      A timeout value in milliseconds..

    Returns Promise<void>

    A promise that resolves if all desired protocols are fulfilled by remote nodes, rejects if the timeoutMs is reached.

Generated using TypeDoc