Skip to main content

Crate coven_ssh

Crate coven_ssh 

Source
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§

PrivateKey
SSH private key.
PublicKey
SSH public key.
SshAuthCredentials
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.