Utility functions for parsing Messages and Resources

Constructors

Methods

  • Beta

    Parses the json message into a message instance. Performs format validation and an integrity check on the signature

    Parameters

    Returns Promise<Message>

    Message

  • Beta

    Parses a json message into an instance of message kind's class. Performs format validation and an integrity check of the signature

    Parameters

    Returns Promise<Resource>

    Resource

  • Util for JSON.parse-ing a stringified Tbdex Message

    Parameters

    • rawMessage: string | MessageModel

      Either a stringified Tbdex Message or an object Tbdex Message

    Returns MessageModel

    A Tbdex Message as an object

    Throws

    If the stringified message could not be JSON.parse'd

  • Util for JSON.parse-ing a stringified Tbdex resource

    Parameters

    • rawResource: string | ResourceModel

      Either a stringified Tbdex resource or an object Tbdex resource

    Returns ResourceModel

    A Tbdex message as an object

    Throws

    If the stringified resource could not be JSON.parse'd