pub fn auth_check<E>(
rules: &AuthorizationRules,
incoming_event: impl Event,
fetch_state: impl Fn(&StateEventType, &str) -> Option<E>,
) -> Result<(), String>where
E: Event,
Available on crate feature
state-res
only.Expand description
Check whether the incoming event passes the authorization rules for the given room version.
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.