ruma_state_res::event_auth

Function auth_check

Source
pub fn auth_check<E: Event>(
    room_version: &RoomVersion,
    incoming_event: impl Event,
    current_third_party_invite: Option<impl Event>,
    fetch_state: impl Fn(&StateEventType, &str) -> Option<E>,
) -> Result<bool>
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.