coven-ssh
SSH key management and authentication utilities for coven services.
This crate provides a unified implementation of SSH-based authentication used by coven-agent, coven-leader, and coven-swarm to communicate with coven-gateway.
Features
- Key Management: Load existing SSH keys or generate new ed25519 keys
- Fingerprinting: Compute SHA256 fingerprints compatible with Go's ssh library
- gRPC Auth: Apply SSH authentication credentials to tonic requests
Example
use coven_ssh::{load_or_generate_key, compute_fingerprint, SshAuthCredentials};
use std::path::PathBuf;
// Load or generate a key
let key_path = PathBuf::from("/path/to/key");
let private_key = load_or_generate_key(&key_path).expect("key should load");
// Compute fingerprint for identification
let fingerprint = compute_fingerprint(private_key.public_key()).expect("fingerprint should compute");
println!("Key fingerprint: {}", fingerprint);
// Create auth credentials for gRPC
let creds = SshAuthCredentials::new(&private_key).expect("credentials should create");
// Apply to a gRPC request
let mut request = tonic::Request::new(());
creds.apply_to_request(&mut request).expect("should apply");