HTTP client for interacting with TBDex PFIs

Constructors

Methods

  • Sends an RFQ and options to the PFI to initiate an exchange

    Parameters

    • rfq: Rfq

      The RFQ message that will be sent to the PFI

    • Optional opts: {
          replyTo?: string;
      }
      • Optional replyTo?: string

        A callback URL where the PFI will send subsequent messages

    Returns Promise<void>

    Throws

    if message verification fails

    Throws

    if recipient DID resolution fails

    Throws

    if recipient DID does not have a PFI service entry

  • Creates and signs a request token (JWT) that's included as the value of Authorization header for requests sent to a PFI API's endpoints that require authentication

    JWT payload with the following claims:

    • aud
    • iss
    • exp
    • iat
    • jti The JWT is then signed and returned.

    Parameters

    Returns Promise<string>

    the request token (JWT)

    Throws

    RequestTokenSigningError If an error occurs during the token generation.

  • returns the PFI service entry from the DID Doc of the DID provided

    Parameters

    • did: string

      the pfi's DID

    Returns Promise<DidServiceEndpoint | DidServiceEndpoint[]>

  • Parameters

    • pfiDid: string
    • verb: "GET" | "PUT" | "POST"
    • path: string
    • requestBody: string

    Returns Promise<void>

  • Sends the Close message to the PFI

    Parameters

    Returns Promise<void>

    Throws

    if message verification fails

    Throws

    if recipient DID resolution fails

    Throws

    if recipient DID does not have a PFI service entry

  • Sends the Order message to the PFI

    Parameters

    Returns Promise<void>

    Throws

    if message verification fails

    Throws

    if recipient DID resolution fails

    Throws

    if recipient DID does not have a PFI service entry