vela-protocol 0.950.1

Core library for the Vela scientific knowledge protocol: replayable frontier state, signed canonical events, and proof packets.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub(crate) fn require_artifact_reference_id(
    record: &str,
    field: &str,
    value: &str,
) -> Result<(), String> {
    let valid_text =
        !value.trim().is_empty() && value == value.trim() && !value.chars().any(char::is_control);
    let is_content_hash = value.len() == 64
        && value
            .bytes()
            .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte));
    if valid_text && is_content_hash {
        return Ok(());
    }
    Err(format!(
        "{record} {field} must be a full lowercase content hash"
    ))
}