2026-01-24 22:59:20 +00:00
|
|
|
// Archipelago Bitcoin Node OS - Native Backend
|
|
|
|
|
// Pure Archipelago implementation, no StartOS dependencies
|
|
|
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
|
use std::net::SocketAddr;
|
Update archipelago: API, auth, container, parmanode, performance, security
- API handler, RPC, and server updates
- Auth and coding rules
- Container data manager, dev orchestrator, health monitor, podman client
- Parmanode script runner
- Performance resource manager
- Security container policies and secrets manager
- Add build scripts and documentation
2026-01-27 22:27:17 +00:00
|
|
|
use tracing::info;
|
2026-01-24 22:59:20 +00:00
|
|
|
|
|
|
|
|
mod api;
|
|
|
|
|
mod auth;
|
2026-03-02 08:34:13 +00:00
|
|
|
mod backup;
|
2026-01-24 22:59:20 +00:00
|
|
|
mod config;
|
2026-03-09 07:43:12 +00:00
|
|
|
mod content_server;
|
|
|
|
|
mod credentials;
|
2026-02-17 15:03:34 +00:00
|
|
|
mod electrs_status;
|
2026-01-24 22:59:20 +00:00
|
|
|
mod container;
|
2026-02-17 15:03:34 +00:00
|
|
|
mod port_allocator;
|
2026-01-27 23:06:18 +00:00
|
|
|
mod data_model;
|
2026-02-17 15:03:34 +00:00
|
|
|
mod identity;
|
2026-03-09 07:43:12 +00:00
|
|
|
mod identity_manager;
|
2026-02-17 15:03:34 +00:00
|
|
|
mod node_message;
|
|
|
|
|
mod nostr_discovery;
|
|
|
|
|
mod peers;
|
2026-01-24 22:59:20 +00:00
|
|
|
mod server;
|
2026-03-06 03:26:56 +00:00
|
|
|
mod session;
|
2026-01-27 23:06:18 +00:00
|
|
|
mod state;
|
feat: add TOTP 2FA, API key switcher, login progress bar, and alpha hardening plan
- TOTP 2FA: full setup/confirm/disable/login flow with Argon2id + ChaCha20-Poly1305
encrypted secret storage, QR code generation, and bcrypt-hashed backup codes
- API key switcher: OAuth vs personal API key toggle in AIUI chat settings with
status indicator, key validation, and help text
- Login progress bar: server startup detection with health check polling, form
disabled until server is ready
- AI quarantine docs: comprehensive HTML page documenting all 6 security layers
- Settings: AI Data Access permission toggles with per-category control
- Alpha hardening plan: 28-task overnight automation plan across 7 phases
(onboarding, login, app install, AIUI, UI polish, security, ISO build)
- Backlog: node discovery spatial map feature for alpha demo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 12:23:57 +00:00
|
|
|
mod totp;
|
2026-03-09 07:43:12 +00:00
|
|
|
mod wallet;
|
|
|
|
|
mod names;
|
|
|
|
|
mod network;
|
|
|
|
|
mod nostr_relays;
|
|
|
|
|
mod update;
|
2026-01-24 22:59:20 +00:00
|
|
|
|
2026-01-27 22:37:08 +00:00
|
|
|
use auth::AuthManager;
|
2026-01-24 22:59:20 +00:00
|
|
|
use config::Config;
|
|
|
|
|
use server::Server;
|
|
|
|
|
|
2026-01-27 22:37:08 +00:00
|
|
|
/// Default dev password when auto-creating a user (matches mock-backend).
|
|
|
|
|
const DEV_DEFAULT_PASSWORD: &str = "password123";
|
|
|
|
|
|
2026-01-24 22:59:20 +00:00
|
|
|
#[tokio::main]
|
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
|
// Initialize tracing
|
|
|
|
|
tracing_subscriber::fmt()
|
|
|
|
|
.with_env_filter(
|
|
|
|
|
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
|
|
|
.unwrap_or_else(|_| "archipelago=debug,info".into()),
|
|
|
|
|
)
|
|
|
|
|
.init();
|
|
|
|
|
|
|
|
|
|
info!("🚀 Starting Archipelago Bitcoin Node OS");
|
|
|
|
|
|
|
|
|
|
// Load configuration
|
|
|
|
|
let config = Config::load().await?;
|
|
|
|
|
info!("📁 Data directory: {}", config.data_dir.display());
|
|
|
|
|
|
2026-01-27 22:37:08 +00:00
|
|
|
// In dev mode, ensure a default user exists so login works without manual setup
|
|
|
|
|
if config.dev_mode {
|
|
|
|
|
let auth = AuthManager::new(config.data_dir.clone());
|
|
|
|
|
if !auth.is_setup().await? {
|
|
|
|
|
auth.setup_user(DEV_DEFAULT_PASSWORD).await?;
|
|
|
|
|
info!("👤 Created default dev user (password: {})", DEV_DEFAULT_PASSWORD);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-24 22:59:20 +00:00
|
|
|
// Create server
|
|
|
|
|
let server = Server::new(config.clone()).await?;
|
|
|
|
|
|
|
|
|
|
// Start server
|
|
|
|
|
let addr: SocketAddr = format!("{}:{}", config.bind_host, config.bind_port)
|
|
|
|
|
.parse()
|
|
|
|
|
.expect("Invalid bind address");
|
|
|
|
|
|
|
|
|
|
info!("🌐 Server listening on http://{}", addr);
|
|
|
|
|
info!("📡 RPC API: http://{}/rpc/v1", addr);
|
|
|
|
|
info!("🔌 WebSocket: ws://{}/ws", addr);
|
|
|
|
|
|
|
|
|
|
server.serve(addr).await?;
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|