Function check_pdu_format

Source
pub fn check_pdu_format(
    pdu: &CanonicalJsonObject,
    rules: &EventFormatRules,
) -> Result<(), String>
Expand description

Check that the given canonicalized PDU respects the event format of the room version and the size limits from the Matrix specification.

This is part of the checks performed on receipt of a PDU.

This checks the following and enforces their size limits:

  • Full PDU
  • sender
  • room_id
  • type
  • event_id
  • state_key
  • prev_events
  • auth_events
  • depth

Returns an Err(_) if the JSON is malformed or if the PDU doesn’t pass the checks.