Add native Dosh host trust foundation
ci / test (push) Has been cancelled
ci / remote-bench (push) Has been cancelled

This commit is contained in:
DuProcess
2026-06-13 11:32:01 -04:00
parent f6ab4473bd
commit 26fc863149
9 changed files with 631 additions and 4 deletions
+10 -2
View File
@@ -2,13 +2,16 @@ use anyhow::{Context, Result};
use clap::Parser;
use dosh::auth::{build_bootstrap, encode_bootstrap, load_or_create_server_secret};
use dosh::config::load_server_config;
use dosh::native::{host_public_key, host_public_key_line, load_or_create_host_key};
#[derive(Debug, Parser)]
struct Args {
#[arg(long, default_value_t = 1)]
protocol: u8,
#[arg(long)]
nonce: String,
nonce: Option<String>,
#[arg(long)]
host_key: bool,
#[arg(long, default_value = "default")]
session: String,
#[arg(long, default_value = "read-write")]
@@ -25,8 +28,13 @@ fn main() -> Result<()> {
let args = Args::parse();
anyhow::ensure!(args.protocol == 1, "unsupported protocol {}", args.protocol);
let config = load_server_config(None)?;
if args.host_key {
let signing_key = load_or_create_host_key(&config)?;
println!("{}", host_public_key_line(&host_public_key(&signing_key)));
return Ok(());
}
let secret = load_or_create_server_secret(&config)?;
let nonce = parse_nonce(&args.nonce)?;
let nonce = parse_nonce(args.nonce.as_deref().context("--nonce is required")?)?;
let size = parse_size(&args.size)?;
let user = std::env::var("USER").unwrap_or_else(|_| "unknown".to_string());
let udp_host = args.udp_host.unwrap_or_else(|| "127.0.0.1".to_string());