vios_app 0.1.1

Small JSON vaults: Argon2id + AES-GCM, with optional AAD binding.
Documentation
// 📁 vaultignore.rs — Load and Evaluate .vaultignore Patterns
use std::collections::HashSet;
use std::fs;
use std::path::Path;

/// Loads ignore patterns from a `.vaultignore` file
pub fn load_vaultignore_patterns(ignore_path: &Path) -> HashSet<String> {
    let mut patterns = HashSet::new();

    if let Ok(contents) = fs::read_to_string(ignore_path) {
        for line in contents.lines() {
            let trimmed = line.trim();
            if !trimmed.is_empty() && !trimmed.starts_with('#') {
                patterns.insert(trimmed.to_string());
            }
        }
    }

    patterns
}

/// Returns true if the file path matches any pattern in .vaultignore
pub fn is_ignored(path: &Path, ignore_patterns: &HashSet<String>) -> bool {
    if let Some(file_name) = path.file_name().and_then(|n| n.to_str()) {
        ignore_patterns.contains(file_name)
    } else {
        false
    }
}

/// Returns true if file is NOT ignored (inverse of `is_ignored`)
pub fn is_valid_vault(path: &str, ignore_patterns: &HashSet<String>) -> bool {
    let path_obj = Path::new(path);
    !is_ignored(path_obj, ignore_patterns)
}

pub struct GateConfig {
    pub root: String,
    pub patterns: Vec<String>,
}