securegit 0.8.5

Zero-trust git replacement with 12 built-in security scanners, LLM redteam bridge, universal undo, durable backups, and a 50-tool MCP server
Documentation
use std::path::PathBuf;
use tracing::debug;

/// SSH key types in preference order.
const SSH_KEY_NAMES: &[&str] = &["id_ed25519", "id_ecdsa", "id_rsa"];

/// Discover SSH keys from the default location (~/.ssh/).
pub fn discover_ssh_key() -> Option<PathBuf> {
    let ssh_dir = dirs::home_dir()?.join(".ssh");
    if !ssh_dir.exists() {
        return None;
    }

    for key_name in SSH_KEY_NAMES {
        let key_path = ssh_dir.join(key_name);
        if key_path.exists() {
            debug!("Found SSH key: {}", key_path.display());
            return Some(key_path);
        }
    }

    None
}

/// Discover the public key counterpart.
pub fn public_key_for(private_key: &std::path::Path) -> Option<PathBuf> {
    let pub_path = private_key.with_extension("pub");
    if pub_path.exists() {
        Some(pub_path)
    } else {
        None
    }
}