ACCOUNT CREATION AND LOGIN

This commit is contained in:
2026-02-16 23:56:07 -05:00
parent 79da5e1146
commit 61e9c2ac5c
17 changed files with 2322 additions and 326 deletions
+58
View File
@@ -0,0 +1,58 @@
use derive_more::{Deref, DerefMut};
use iris::core::util::HashMap;
use openworm::rsc::DataRsc;
#[derive(Default, serde::Serialize, serde::Deserialize, Deref, DerefMut)]
pub struct AccountListV0(Vec<AccountInfoV0>);
#[derive(Clone, serde::Serialize, serde::Deserialize)]
pub struct AccountInfoV0 {
pub url: String,
pub username: String,
}
impl AccountInfoV0 {
pub fn path(&self) -> String {
self.username.clone() + "@" + &self.url
}
}
impl DataRsc for AccountListV0 {
fn name() -> &'static str {
"account_list"
}
fn parse_version(text: &str, version: u32) -> Result<Self, String> {
match version {
0 => ron::from_str(text).map_err(|e| e.to_string()),
_ => Err(format!("unknown version {version}")),
}
}
fn version() -> u32 {
0
}
}
#[derive(Debug, Default, serde::Serialize, serde::Deserialize, Deref, DerefMut)]
pub struct ServerListV0(HashMap<String, ServerInfoV0>);
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct ServerInfoV0 {
pub cert_hex: String,
}
impl DataRsc for ServerListV0 {
fn name() -> &'static str {
"server_list"
}
fn parse_version(text: &str, version: u32) -> Result<Self, String> {
match version {
0 => ron::from_str(text).map_err(|e| e.to_string()),
_ => Err(format!("unknown version {version}")),
}
}
fn version() -> u32 {
0
}
}