From 6fbb5f19cab02f3a0f18cdeda3da02e717b69cd6 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Tue, 13 Jan 2026 15:37:55 +0800 Subject: feat: add offline account management and version fetching functionality --- src-tauri/src/core/auth.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src-tauri/src/core/auth.rs (limited to 'src-tauri/src/core/auth.rs') diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rs new file mode 100644 index 0000000..39c4ce0 --- /dev/null +++ b/src-tauri/src/core/auth.rs @@ -0,0 +1,28 @@ +use serde::{Deserialize, Serialize}; +use std::sync::Mutex; +use uuid::Uuid; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OfflineAccount { + pub username: String, + pub uuid: String, +} + +pub struct AccountState { + pub active_account: Mutex>, +} + +impl AccountState { + pub fn new() -> Self { + Self { + active_account: Mutex::new(None), + } + } +} + +pub fn generate_offline_uuid(username: &str) -> String { + // Generate a UUID v3 (MD5-based) using the username as the name + // This provides a consistent UUID for the same username + let namespace = Uuid::NAMESPACE_OID; + Uuid::new_v3(&namespace, username.as_bytes()).to_string() +} -- cgit v1.2.3-70-g09d2