Function ruma_state_res::event_auth::auth_check[][src]

pub fn auth_check<E, F>(
    room_version: &RoomVersion,
    incoming_event: &Arc<E>,
    prev_event: Option<Arc<E>>,
    current_third_party_invite: Option<Arc<E>>,
    fetch_state: F
) -> Result<bool> where
    E: Event,
    F: Fn(&EventType, &str) -> Option<Arc<E>>, 
Expand description

Authenticate the incoming event. The steps of authentication are:

  • check that the event is being authenticated for the correct room
  • check that the events signatures are valid
  • then there are checks for specific event types

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.

Returns

This returns an Error only when serialization fails or some other fatal outcome.