Onboarding wizard and MA signup/enroll site

This commit is contained in:
George Coles
2026-09-15 09:35:24 -04:00
parent 1297766e8a
commit 15e5c6cbd7
12 changed files with 794 additions and 17 deletions
+28 -6
View File
@@ -5,7 +5,7 @@ use clap::{Parser, Subcommand, ValueEnum};
use frxd::config::Config;
use frxd::crypto::Keypair;
use frxd::message::{EXPOSURE_FULL, EXPOSURE_METADATA};
use frxd::{commands, node, relay};
use frxd::{commands, node, onboard, relay};
#[derive(Parser)]
#[command(
@@ -16,8 +16,10 @@ use frxd::{commands, node, relay};
struct Cli {
#[arg(long, global = true, default_value = "frxd.toml")]
config: PathBuf,
#[arg(long)]
onboarding: bool,
#[command(subcommand)]
command: Command,
command: Option<Command>,
}
#[derive(Subcommand)]
@@ -139,7 +141,10 @@ enum KeyCommand {
#[derive(Subcommand)]
enum RegistryCommand {
Init,
Init {
#[arg(long, default_value = "frx.invalid")]
zone: String,
},
Add {
id: String,
pubkey: String,
@@ -180,6 +185,10 @@ enum RegistryCommand {
Serve {
#[arg(long, default_value = "127.0.0.1:7800")]
listen: String,
#[arg(long)]
signup_code: Option<String>,
#[arg(long)]
registry_url: Option<String>,
},
}
@@ -192,7 +201,16 @@ enum Exposure {
#[tokio::main]
async fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
if cli.onboarding {
let mut input = std::io::stdin().lock();
let mut output = std::io::stdout().lock();
onboard::run(&mut input, &mut output, &cli.config).await?;
return Ok(());
}
let Some(command) = cli.command else {
bail!("no subcommand given (try --onboarding or --help)");
};
match command {
Command::Init {
name,
listen,
@@ -309,7 +327,7 @@ async fn main() -> Result<()> {
KeyCommand::Rotate => commands::key_rotate(&cli.config)?,
},
Command::Registry { dir, command } => match command {
RegistryCommand::Init => commands::registry_init(&dir)?,
RegistryCommand::Init { zone } => commands::registry_init(&dir, &zone)?,
RegistryCommand::Add {
id,
pubkey,
@@ -336,7 +354,11 @@ async fn main() -> Result<()> {
RegistryCommand::List => commands::registry_list(&dir)?,
RegistryCommand::SetRelays { relays } => commands::registry_set_relays(&dir, &relays)?,
RegistryCommand::Show => commands::registry_show(&dir)?,
RegistryCommand::Serve { listen } => commands::registry_serve(&dir, &listen).await?,
RegistryCommand::Serve {
listen,
signup_code,
registry_url,
} => commands::registry_serve(&dir, &listen, signup_code, registry_url).await?,
},
Command::Aggregates {
from,