diff --git a/crates/ruma-state-res/src/event_auth.rs b/crates/ruma-state-res/src/event_auth.rs index 4334f55b..0bd7fdae 100644 --- a/crates/ruma-state-res/src/event_auth.rs +++ b/crates/ruma-state-res/src/event_auth.rs @@ -16,8 +16,8 @@ use tracing::{debug, info, warn}; use crate::{room_version::RoomVersion, Error, Event, Result, StateMap}; -/// For the given event `kind` what are the relevant auth events -/// that are needed to authenticate this `content`. +/// For the given event `kind` what are the relevant auth events that are needed to authenticate +/// this `content`. pub fn auth_types_for_event( kind: &EventType, sender: &UserId, @@ -70,16 +70,19 @@ pub fn auth_types_for_event( auth_types } -/// Authenticate the incoming `event`. The steps of authentication are: +/// 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. +/// 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. pub fn auth_check( room_version: &RoomVersion, @@ -296,8 +299,9 @@ where /// * `user` - Information about the membership event and user making the request. /// * `prev_event` - The event that occurred immediately before the `user` event or None. /// * `auth_events` - The set of auth events that relate to a membership event. -/// this is generated by calling `auth_types_for_event` with the membership event and -/// the current State. +/// +/// This is generated by calling `auth_types_for_event` with the membership event and the current +/// State. pub fn valid_membership_change( state_key: &str, user_sender: &UserId, @@ -512,8 +516,9 @@ where Some(membership == MembershipState::Join) } -/// Is the user allowed to send a specific event based on the rooms power levels. Does the event -/// have the correct userId as it's state_key if it's not the "" state_key. +/// Is the user allowed to send a specific event based on the rooms power levels. +/// +/// Does the event have the correct userId as its state_key if it's not the "" state_key. pub fn can_send_event(event: &Arc, fetch_state: F) -> bool where E: Event,