Function ruma_common::user_id::localpart_is_fully_conforming

source ·
pub fn localpart_is_fully_conforming(localpart: &str) -> Result<bool, Error>
Expand description

Check whether the given user id localpart is valid and fully conforming

Returns an Err for invalid user ID localparts, Ok(false) for historical user ID localparts and Ok(true) for fully conforming user ID localparts.

With the compat feature enabled, this will also return Ok(false) for invalid user ID localparts. User IDs that don’t even meet the historical user ID restrictions exist in the wild due to Synapse allowing them over federation. This will likely be fixed in an upcoming room version; see MSC2828.