feat: implement production cas v1

This commit is contained in:
2026-06-28 12:39:17 +08:00
parent dd53e3054e
commit b202d7b231
33 changed files with 1082 additions and 447 deletions
+3 -6
View File
@@ -29,14 +29,11 @@ impl Hash {
/// 从十六进制字符串解析
pub fn from_hex(s: &str) -> Result<Self, crate::error::CasError> {
let bytes = hex::decode(s).map_err(|_| {
crate::error::CasError::Other(anyhow::anyhow!("Invalid hex string"))
})?;
let bytes =
hex::decode(s).map_err(|_| crate::error::CasError::InvalidHash(s.to_string()))?;
if bytes.len() != 32 {
return Err(crate::error::CasError::Other(anyhow::anyhow!(
"Hash must be 32 bytes"
)));
return Err(crate::error::CasError::InvalidHash(s.to_string()));
}
let mut hash_bytes = [0u8; 32];