Whiteflag JavaScript Library - v1.0.0
    Preparing search index...

    A core Whiteflag message as defined by the Whiteflag specification WfCoreMessage

    v1-draft.7

    4 Message Format

    Ths class represents a core Whiteflag message as defined by the Whiteflag specification. It has a message header and a message body which contain the message fields as specified for the message type. It performs the encoding/encryption and decoding/decryption to and from binary messages. Since the processing of Whiteflag messges in accordance with the protocol requires additional metadata, the extrended WfMessage class of the @whitelag/protol package should normallly be used instead of this class.

    Hierarchy (View Summary)

    Index

    Constructors

    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

      Indicates if the message has already been encoded isEncoded

      Returns boolean

      true if message has been encoded, else false

    • 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

      Returns the Whiteflag message encoded as a hexadecimal string toHex

      Returns string

      a hexadecimal string with the encoded message

    • Function

      Returns the Whiteflag message as a plain object toObject

      Returns Object

      the message as a plain object

    • Function

      Returns the Whiteflag message as a string toString

      Returns string

      a concatinated string of field values

    • Function

      Returns the encoded Whiteflag message as a UInt8array toU8a

      Returns Uint8Array

      a UInt8array with the encoded message

    • Function

      Returns message validation errors validate

      Returns string[]

      an array of validation errors

    • 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: any

        a plain JavaScript object with message header and body

      Returns Promise<WfCoreMessage>

      a new Whiteflag message object

    • 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