MCPcopy Create free account
hub / github.com/chatmail/core / validate_id

Function validate_id

src/tools.rs:298–301  ·  view source on GitHub ↗

Returns true if given string is a valid ID. All IDs generated with `create_id()` should be considered valid.

(s: &str)

Source from the content-addressed store, hash-verified

296///
297/// All IDs generated with `create_id()` should be considered valid.
298pub(crate) fn validate_id(s: &str) -> bool {
299 let alphabet = base64::alphabet::URL_SAFE.as_str();
300 s.chars().all(|c| alphabet.contains(c)) && s.len() > 10 && s.len() <= 32
301}
302
303pub(crate) fn validate_broadcast_secret(s: &str) -> bool {
304 let alphabet = base64::alphabet::URL_SAFE.as_str();

Callers 2

decode_openpgpFunction · 0.85
get_chat_group_idMethod · 0.85

Calls 2

as_strMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected