diff --git a/lib/wasix/src/runtime/resolver/inputs.rs b/lib/wasix/src/runtime/resolver/inputs.rs index 92735769e05..8fb2b7f8cb7 100644 --- a/lib/wasix/src/runtime/resolver/inputs.rs +++ b/lib/wasix/src/runtime/resolver/inputs.rs @@ -337,6 +337,13 @@ impl WebcHash { WebcHash(bytes) } + /// Parse a sha256 hash from a hex-encoded string. + pub fn parse_hex(hex_str: &str) -> Result { + let mut hash = [0_u8; 32]; + hex::decode_to_slice(hex_str, &mut hash)?; + Ok(Self(hash)) + } + pub fn for_file(path: impl AsRef) -> Result { let mut hasher = Sha256::default(); let mut reader = BufReader::new(File::open(path)?); diff --git a/lib/wasix/src/runtime/resolver/wapm_source.rs b/lib/wasix/src/runtime/resolver/wapm_source.rs index acd61116b65..5eda690aa43 100644 --- a/lib/wasix/src/runtime/resolver/wapm_source.rs +++ b/lib/wasix/src/runtime/resolver/wapm_source.rs @@ -215,9 +215,7 @@ fn decode_summary(pkg_version: WapmWebQueryGetPackageVersion) -> Result