vios_app 0.1.1

Small JSON vaults: Argon2id + AES-GCM, with optional AAD binding.
Documentation
use sha2::{Digest, Sha256};
use std::fs;
use std::path::Path;

pub fn check_vault_integrity(path: &str) -> bool {
    let file = Path::new(path);
    if !file.exists() {
        return false;
    }

    let bytes = match fs::read(file) {
        Ok(b) => b,
        Err(_) => return false,
    };

    let mut hasher = Sha256::new();
    hasher.update(&bytes);
    let computed = format!("{:x}", hasher.finalize());

    let seal_path = file.with_extension("vaultseal");
    if !seal_path.exists() {
        return false;
    }

    let seal_contents = match fs::read_to_string(seal_path) {
        Ok(s) => s,
        Err(_) => return false,
    };

    seal_contents.contains(&computed)
}