use crate::FORMAT;
pub const ALGORITHM: &str = "sha256-jcs/1";
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum ManifestError {
#[error("the manifest names format `{0}`; this implementation reads `{FORMAT}`")]
UnknownFormat(String),
#[error("the manifest names algorithm `{0}`; this implementation computes `{ALGORITHM}`")]
UnknownAlgorithm(String),
}
pub fn check_identifiers(format: &str, algorithm: &str) -> Result<(), ManifestError> {
if format != FORMAT {
return Err(ManifestError::UnknownFormat(format.to_owned()));
}
if algorithm != ALGORITHM {
return Err(ManifestError::UnknownAlgorithm(algorithm.to_owned()));
}
Ok(())
}