Message sent by Alice to PFI to request a quote (RFQ)

Hierarchy (view full)

Constructors

Properties

_signature: undefined | string

signature that verifies that authenticity and integrity of a message

data: RfqData

Rfq's data containing information to initiate an exchange between Alice and a PFI

kind: "rfq" = 'rfq'

The message kind (rfq)

metadata: RfqMetadata

Metadata such as sender, recipient, date created, and ID

privateData: undefined | RfqPrivateData

Rfq's unhashed private information to initiate an exchange between Alice and a PFI

validNext: Set<MessageKind> = ...

a set of valid Message kinds that can come after an rfq

Accessors

  • get createdAt(): string
  • Message creation time. Expressed as ISO8601

    Returns string

  • get exchangeId(): string
  • ID for an "exchange" of messages between Alice - PFI. Uses the id of the RFQ that initiated the exchange

    Returns string

  • get externalId(): undefined | string
  • the external ID

    Returns undefined | string

  • get from(): string
  • The sender's DID

    Returns string

  • get id(): string
  • the message id

    Returns string

  • get protocol(): `${number}`
  • the protocol version

    Returns `${number}`

  • get signature(): undefined | string
  • the message's cryptographic signature

    Returns undefined | string

  • get to(): string
  • the recipient's DID

    Returns string

Methods

  • Computes a digest of the payload by:

    Returns Uint8Array

    The SHA-256 hash of the canonicalized payload, represented as a byte array.

  • Signs the message as a jws with detached content and sets the signature property

    Parameters

    • did: BearerDid

      the signer's DID

    Returns Promise<void>

    Throws

    If the signature could not be produced

  • Valid structure of the message including the presence of the signature using the official spec JSON Schemas

    Returns void

    Throws

    If the message's structure does not match the JSON schemas

  • Validates data section of message only using the official TBDex JSON Schemas. This is useful for partially validating unsigned messages.

    Returns void

    Throws

    If the structure of the messages's data does not match the JSON schemas

  • Validates the message structure and verifies the cryptographic signature

    Returns Promise<string>

    Signer's DID

    Throws

    if the message signature is invalid

    Throws

    if the message structure is invalid

    Throws

    see Crypto.verify

  • Verify the presence and integrity of all possible properties in Rfq.privateData.

    Returns void

    Throws

    if there are properties missing in Rfq.privateData or which do not match the corresponding hashed property in Rfq.data

  • checks the claims provided in this rfq against an offering's requirements

    Parameters

    • offering: Offering

      the offering to check against

    Returns Promise<void>

    Throws

    if rfq's claims do not fulfill the offering's requirements

  • Returns void

  • evaluates this rfq against the provided offering

    Parameters

    • offering: Offering

      the offering to evaluate this rfq against

    Returns Promise<void>

    Throws

    if Rfq.data.offeringId doesn't match the provided offering's id

    See

    RfqData#offeringId

    Throws

    if payinAmount in Rfq.data exceeds the provided offering's max units allowed or is below the offering's min units allowed

    Throws

    if payinMethod in Rfq.data property kind cannot be validated against the provided offering's payinMethod kinds

    Throws

    if payinMethod in Rfq.data property paymentDetails cannot be validated against the provided offering's payinMethod requiredPaymentDetails

    Throws

    if payoutMethod in Rfq.data property kind cannot be validated against the provided offering's payoutMethod kinds

    Throws

    if payoutMethod in Rfq.data property paymentDetails cannot be validated against the provided offering's payoutMethod requiredPaymentDetails

  • Returns void

  • Validate the Rfq's payin/payout method against an Offering's allow payin/payout methods

    Parameters

    • selectedPaymentKind: undefined | string
    • selectedPaymentDetailsHash: undefined | string
    • selectedPaymentDetails: undefined | Record<string, any>
    • allowedPaymentMethods: PayinMethod[]

      The Offering's allowed payin/payout methods

    • payDirection: "payin" | "payout"

      Either 'payin' or 'payout', used to provide more detailed error messages.

    Returns void

    Throws

    if rfqPaymentMethod property kind cannot be validated against the provided offering's paymentMethod's kinds

    Throws

    if Rfq.privateData property paymentDetails is missing but is necessary to validate against the provided offering's paymentMethod's kinds

    Throws

    if rfqPaymentMethod property paymentDetails cannot be validated against the provided offering's paymentMethod's requiredPaymentDetails

  • Returns void

  • Verify the integrity properties that are present in Rfq.privateData.

    Returns void

    Throws

    if there are properties present in Rfq.privateData which do not match the corresponding hashed property in Rfq.data

  • Verifies the integrity of the cryptographic signature

    Returns Promise<string>

    Resource signer's DID

    Throws

    if the resource signature is invalid

    Throws

    if the signer's DID does not match Resource.metadata.from

  • Creates an rfq with the given options

    Parameters

    Returns Rfq

    Rfq

  • Given a salt and a value, compute a deterministic digest used in hashed fields in RfqData

    Parameters

    • salt: string
    • value: any

    Returns string

    salted hash of the private data value

  • Generates a unique id with the message kind's prefix

    Parameters

    Returns string

  • Parses a json message into an Rfq

    Parameters

    Returns Promise<Rfq>

    The parsed Rfq

    Throws

    if the rfq could not be parsed or is not a valid Rfq