use std::collections::HashMap; use std::fs; use std::sync::{Arc, Mutex}; use mtp::crypto::PublicKeyBundle; pub fn load_client_db( path: &str, ) -> Result<(Arc>>, Arc>), Box> { let clients: Arc>> = Arc::new(Mutex::new(if let Ok(data) = fs::read_to_string(path) { serde_json::from_str(&data).unwrap_or_default() } else { HashMap::new() })); let next_id = Arc::new(Mutex::new( clients.lock().unwrap().keys().max().unwrap_or(&999) + 1, )); Ok((clients, next_id)) }