state-res: Fix up doc comments
This commit is contained in:
parent
4bea59caef
commit
a56814a4f4
@ -16,8 +16,8 @@ use tracing::{debug, info, warn};
|
|||||||
|
|
||||||
use crate::{room_version::RoomVersion, Error, Event, Result, StateMap};
|
use crate::{room_version::RoomVersion, Error, Event, Result, StateMap};
|
||||||
|
|
||||||
/// For the given event `kind` what are the relevant auth events
|
/// For the given event `kind` what are the relevant auth events that are needed to authenticate
|
||||||
/// that are needed to authenticate this `content`.
|
/// this `content`.
|
||||||
pub fn auth_types_for_event(
|
pub fn auth_types_for_event(
|
||||||
kind: &EventType,
|
kind: &EventType,
|
||||||
sender: &UserId,
|
sender: &UserId,
|
||||||
@ -70,16 +70,19 @@ pub fn auth_types_for_event(
|
|||||||
auth_types
|
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 event is being authenticated for the correct room
|
||||||
/// * check that the events signatures are valid
|
/// * check that the events signatures are valid
|
||||||
/// * then there are checks for specific event types
|
/// * then there are checks for specific event types
|
||||||
///
|
///
|
||||||
/// The `fetch_state` closure should gather state from a state snapshot.
|
/// The `fetch_state` closure should gather state from a state snapshot. We need to know if the
|
||||||
/// We need to know if the event passes auth against some state not a recursive
|
/// event passes auth against some state not a recursive collection of auth_events fields.
|
||||||
/// collection of auth_events fields.
|
|
||||||
///
|
///
|
||||||
/// ## Returns
|
/// ## Returns
|
||||||
|
///
|
||||||
/// This returns an `Error` only when serialization fails or some other fatal outcome.
|
/// This returns an `Error` only when serialization fails or some other fatal outcome.
|
||||||
pub fn auth_check<E, F>(
|
pub fn auth_check<E, F>(
|
||||||
room_version: &RoomVersion,
|
room_version: &RoomVersion,
|
||||||
@ -296,8 +299,9 @@ where
|
|||||||
/// * `user` - Information about the membership event and user making the request.
|
/// * `user` - Information about the membership event and user making the request.
|
||||||
/// * `prev_event` - The event that occurred immediately before the `user` event or None.
|
/// * `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.
|
/// * `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<E, F>(
|
pub fn valid_membership_change<E, F>(
|
||||||
state_key: &str,
|
state_key: &str,
|
||||||
user_sender: &UserId,
|
user_sender: &UserId,
|
||||||
@ -512,8 +516,9 @@ where
|
|||||||
Some(membership == MembershipState::Join)
|
Some(membership == MembershipState::Join)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is the user allowed to send a specific event based on the rooms power levels. Does the event
|
/// Is the user allowed to send a specific event based on the rooms power levels.
|
||||||
/// have the correct userId as it's state_key if it's not the "" state_key.
|
///
|
||||||
|
/// Does the event have the correct userId as its state_key if it's not the "" state_key.
|
||||||
pub fn can_send_event<E, F>(event: &Arc<E>, fetch_state: F) -> bool
|
pub fn can_send_event<E, F>(event: &Arc<E>, fetch_state: F) -> bool
|
||||||
where
|
where
|
||||||
E: Event,
|
E: Event,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user