Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • WakuMessage

Index

Constructors

  • new WakuMessage(proto: WakuMessage, _signaturePublicKey?: Uint8Array, _signature?: Uint8Array): WakuMessage

Properties

proto: WakuMessage

Accessors

  • get contentTopic(): undefined | string
  • get payload(): undefined | Uint8Array
  • get payloadAsUtf8(): string
  • get signature(): undefined | Uint8Array
  • get signaturePublicKey(): undefined | Uint8Array
  • get timestamp(): undefined | Date
  • get version(): undefined | number

Methods

  • encode(): Uint8Array
  • decode(bytes: Uint8Array, decryptionKeys?: { contentTopic?: string[]; key: Uint8Array; method?: DecryptionMethod }[]): Promise<undefined | WakuMessage>
  • Decode a byte array into Waku Message.

    params

    bytes The message encoded using protobuf as defined in 14/WAKU2-MESSAGE.

    params

    decryptionKeys If the payload is encrypted (version = 1), then the keys are used to attempt decryption of the message. The passed key can either be asymmetric private keys or symmetric keys, both method are tried for each key until the message is decrypted or combinations are run out.

    Parameters

    • bytes: Uint8Array
    • Optional decryptionKeys: { contentTopic?: string[]; key: Uint8Array; method?: DecryptionMethod }[]

    Returns Promise<undefined | WakuMessage>

  • decodeProto(protoBuf: WakuMessage, decryptionKeys?: { contentTopics?: string[]; key: Uint8Array; method?: DecryptionMethod }[]): Promise<undefined | WakuMessage>
  • Decode and decrypt Waku Message Protobuf Object into Waku Message.

    params

    protoBuf The message to decode and decrypt.

    params

    decryptionKeys If the payload is encrypted (version = 1), then the keys are used to attempt decryption of the message. The passed key can either be asymmetric private keys or symmetric keys, both method are tried for each key until the message is decrypted or combinations are run out.

    Parameters

    • protoBuf: WakuMessage
    • Optional decryptionKeys: { contentTopics?: string[]; key: Uint8Array; method?: DecryptionMethod }[]

    Returns Promise<undefined | WakuMessage>

  • fromBytes(payload: Uint8Array, contentTopic: string, opts?: Options): Promise<WakuMessage>
  • Create a Waku Message with the given payload.

    By default, the payload is kept clear (version 0). If opts.encPublicKey is passed, the payload is encrypted using asymmetric encryption (version 1).

    If opts.sigPrivKey is passed and version 1 is used, the payload is signed before encryption.

    throws

    if both opts.encPublicKey and opt.symKey are passed

    Parameters

    • payload: Uint8Array
    • contentTopic: string
    • Optional opts: Options

    Returns Promise<WakuMessage>

Generated using TypeDoc