whiteflag-js
    Preparing search index...

    A Whiteflag message as defined by the Whiteflag specification WfMessage

    v1-draft.7

    4 Message Format

    This class extends the core Whiteflag message class by adding metadata to the message, additional data conversions (such as to and from JSON), and specific Whiteflag protocol features. This allows the class to be used and integrated in larger functional applications in accordance with the Whiteflag specification.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    meta: WfMetaHeader = {}

    The message metadata required for processing the message

    Methods

    • Function

      Encodes the message, making the contents final encode

      Parameters

      • Optionalikm: Uint8Array<ArrayBufferLike>

        the input key material to derive the encryption key, if the message is to be encrypted

      • Optionaladdress: Uint8Array<ArrayBufferLike>

        the binary encoded originator address, if the message is to be encrypted

      • Optionaliv: Uint8Array<ArrayBufferLike>

        the initialisation vector, if required for the encryption method

      Returns Promise<WfCoreMessage>

      this Whitedlag message object with the encoded message

    • Function

      Returns the value of the specified message field get

      Parameters

      • fieldName: string

        the name of the message field

      Returns string | null

      the value of the message field

    • Function

      Returns the value of the metaheader field getMeta

      Parameters

      • fieldName: string

        the name of the metaheader field

      Returns string | null

      the value of the metaheader field

    • Function

      Indicates if the message is valid, i.e. if all fields contain valid values isValid

      Returns boolean

      true if message is valid, else false

    • Function

      Sets the value of the specified message field, if the message has not been encoded set

      Parameters

      • fieldName: string

        the name of the message field

      • value: string

        the value to set

      Returns boolean

      true if succesful, else false

    • Function

      Sets the value of the specified metaheader field setMeta

      Parameters

      • fieldName: string

        the name of the metaheader field

      • value: string

        the value to set

      Returns boolean

      true if succesful, else false

    • Function

      Returns the Whiteflag message as a plain object toObject

      Returns string

      the message as a plain object

    • Function

      Creates new Whiteflag message from a binary buffer fromBinary

      Parameters

      • message: BinaryBuffer

        a binary buffer with the encoded message

      • Optionalikm: Uint8Array<ArrayBufferLike>

        the input key material to derive the encryption key, if the message is encrypted

      • Optionaladdress: Uint8Array<ArrayBufferLike>

        the binary encoded originator address, if the message is encrypted

      • Optionaliv: Uint8Array<ArrayBufferLike>

        the initialisation vector, if required for the encryption method

      Returns Promise<WfCoreMessage>

      a new Whiteflag message object with the decoded message

    • Creates new Whiteflag message from a hexadecimal encoded string

      Parameters

      • message: string

        atring with the hexadecimal encoded message

      • Optionalikm: string

        the hexadecimalinput key material to derive the encryption key, if the message is encrypted

      • Optionaladdress: string

        the hexadecimal encoded originator address, if the message is encrypted

      • Optionaliv: string

        the hexadecimal initialisation vector, if required for the encryption method

      Returns Promise<WfCoreMessage>

      a new Whiteflag message object with the decoded message

    • Function

      Creates new Whiteflag message from a plain object fromObject

      Parameters

      • message: string

        a plain JavaScript object with message header and body

      Returns Promise<WfMessage>

      a new Whiteflag message

      if message could not be created

    • Creates new Whiteflag message from a binary encoded message

      Parameters

      • message: Uint8Array

        a Uint8Array with the binary encoded message

      • Optionalikm: Uint8Array<ArrayBufferLike>

        the input key material to derive the encryption key, if the message is encrypted

      • Optionaladdress: Uint8Array<ArrayBufferLike>

        the binary encoded originator address, if the message is encrypted

      • Optionaliv: Uint8Array<ArrayBufferLike>

        the initialisation vector, if required for the encryption method

      Returns Promise<WfCoreMessage>

      a new Whiteflag message object with the decoded message