Skip to main content

check_auth

Function check_auth 

Source
pub fn check_auth(event: &LeanEvent, state: &RoomState) -> Result<(), AuthError>
Expand description

Check whether event is authorized given the room state at its prev_events.

This implements the core Matrix authorization rules:

  1. m.room.create must be the first event (no prev_events).
  2. Sender must be a joined member (unless joining/being invited).
  3. Sender must not be banned.
  4. Sender’s power level must meet the event type requirement.
  5. For m.room.member events, the state_key must match transition rules.