Skip to main content

check_state_dependent_auth_rules

Function check_state_dependent_auth_rules 

Source
pub(super) async fn check_state_dependent_auth_rules<Fetch, Fut, Pdu>(
    rules: &RoomVersionRules,
    incoming_event: &Pdu,
    fetch_state: &Fetch,
) -> Result
where Fetch: Fn(StateEventType, StateKey) -> Fut + Sync, Fut: Future<Output = Result<Pdu>> + Send, Pdu: Event,
Expand description

Check whether the incoming event passes the state-dependent authorization rules for the given room version rules.

The state-dependent rules are all the remaining rules not checked by check_state_independent_auth_rules().

This method should be called several times for an event, to perform the checks on receipt of a PDU.

The fetch_state closure should gather state from a state snapshot. We need to know if the event passes auth against some state not a recursive collection of auth_events fields.

This assumes that ruma_signatures::verify_event() was called previously, as some authorization rules depend on the signatures being valid on the event.

ยงErrors

If the check fails, this returns an Err(_) with a description of the check that failed.