Expand description
§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");Structs§
- Private
Key - SSH private key.
- Public
Key - SSH public key.
- SshAuth
Credentials - SSH authentication credentials for gRPC metadata.
Enums§
- SshError
- Errors that can occur during SSH key operations.
Functions§
- compute_
fingerprint - Compute SHA256 fingerprint of a public key (hex encoded, lowercase).
- current_
timestamp - Get current Unix timestamp in seconds.
- default_
agent_ key_ path - Get the default SSH key path for coven-agent (~/.config/coven/agent_key).
- default_
client_ key_ path - Get the default SSH key path for coven-tui/clients (~/.config/coven/client_key).
- default_
swarm_ key_ path - Get the default SSH key path for coven-swarm (~/.config/coven/coven-swarm/agent_key).
- generate_
key - Generate a new ed25519 SSH key pair and save to disk.
- generate_
nonce - Generate a random nonce for authentication.
- load_
key - Load an existing SSH private key from disk.
- load_
or_ generate_ key - Load an existing SSH key or generate a new one if it doesn’t exist.
- sign_
message - Sign a message with the private key.
- xdg_
config_ dir - Get XDG-style config directory (~/.config/coven).
Type Aliases§
- Result
- Result type alias using SshError.