use anyhow::{anyhow, Result};
pub fn verify_payload(blobs: &[&[u8]], uninstaller_data: &[u8], expected: &[u8; 32]) -> Result<()> {
use sha2::{Digest, Sha256};
let mut h = Sha256::new();
for b in blobs {
h.update(b);
}
h.update(uninstaller_data);
let got: [u8; 32] = h.finalize().into();
if &got != expected {
return Err(anyhow!(
"installer payload integrity check failed — the file may be corrupt or tampered with"
));
}
Ok(())
}
pub enum EmbeddedEntry {
File {
source_path_hash: u64,
data: &'static [u8],
compression: &'static str,
},
Dir {
source_path_hash: u64,
children: &'static [DirChild],
},
}
pub struct DirChild {
pub name: &'static str,
pub kind: DirChildKind,
}
pub enum DirChildKind {
File {
data: &'static [u8],
compression: &'static str,
},
Dir {
children: &'static [DirChild],
},
}