Skip to main content

vfa_tui/models/
integrity.rs

1use serde::{Deserialize, Serialize};
2
3/// Top-level asset integrity manifest.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5#[serde(deny_unknown_fields)]
6pub struct AssetIntegrity {
7    pub manifest_version: u32,
8    pub algorithm: String,
9    pub scope: IntegrityScope,
10    pub trees: Vec<IntegrityTree>,
11    pub root_files: Vec<IntegrityFile>,
12    pub aggregate_sha256: String,
13}
14
15/// Defines which trees and root files are in scope for integrity checks.
16#[derive(Debug, Clone, Serialize, Deserialize)]
17#[serde(deny_unknown_fields)]
18pub struct IntegrityScope {
19    pub trees: Vec<String>,
20    pub root_files: Vec<String>,
21}
22
23/// A directory tree with its aggregate hash and file entries.
24#[derive(Debug, Clone, Serialize, Deserialize)]
25#[serde(deny_unknown_fields)]
26pub struct IntegrityTree {
27    pub tree: String,
28    pub aggregate_sha256: String,
29    pub files: Vec<IntegrityFile>,
30}
31
32/// A single file entry with its hash and size.
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(deny_unknown_fields)]
35pub struct IntegrityFile {
36    pub path: String,
37    pub sha256: String,
38    pub bytes: u64,
39}