ruma_identifiers_validation/
base64_public_key.rs

1use crate::Error;
2
3pub fn validate(s: &str) -> Result<(), Error> {
4    if s.is_empty() {
5        return Err(Error::Empty);
6    } else if !s.chars().all(|c| c.is_alphanumeric() || matches!(c, '+' | '/' | '=')) {
7        return Err(Error::InvalidCharacters);
8    }
9    Ok(())
10}