WakuMessage | js-waku
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • WakuMessage

Index

Constructors

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

    • proto: WakuMessage
    • Optional _signaturePublicKey: Uint8Array
    • Optional _signature: Uint8Array

    Returns WakuMessage

Properties

proto: WakuMessage

Accessors

  • get contentTopic(): undefined | string
  • Returns undefined | string

  • get payload(): undefined | Uint8Array
  • Returns undefined | Uint8Array

  • get payloadAsUtf8(): string
  • Returns string

  • get signature(): undefined | Uint8Array
  • The signature of the message.

    MAY be present if the message is version 1.

    Returns undefined | Uint8Array

  • get signaturePublicKey(): undefined | Uint8Array
  • The public key used to sign the message.

    MAY be present if the message is version 1.

    Returns undefined | Uint8Array

  • get timestamp(): undefined | Date
  • Returns undefined | Date

  • get version(): undefined | number
  • Returns undefined | number

Methods

  • encode(): Uint8Array
  • Returns 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 .

    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>

  • Create Message with an utf-8 string as payload.

    Parameters

    • utf8: string
    • contentTopic: string
    • Optional opts: Options

    Returns Promise<WakuMessage>

Generated using