pub fn check_state_dependent_auth_rules<E: Event>(
rules: &AuthorizationRules,
incoming_event: impl Event,
fetch_state: impl Fn(&StateEventType, &str) -> Option<E>,
) -> Result<(), String>
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.