diff options
| author | 2026-01-13 15:37:55 +0800 | |
|---|---|---|
| committer | 2026-01-13 15:37:55 +0800 | |
| commit | 6fbb5f19cab02f3a0f18cdeda3da02e717b69cd6 (patch) | |
| tree | bb84869afeb316e2510018e2ba33c651488f3e71 /src-tauri/src/core/auth.rs | |
| parent | b7e7f8de3d2200ef34510cda3601a50f62af798d (diff) | |
| download | DropOut-6fbb5f19cab02f3a0f18cdeda3da02e717b69cd6.tar.gz DropOut-6fbb5f19cab02f3a0f18cdeda3da02e717b69cd6.zip | |
feat: add offline account management and version fetching functionality
Diffstat (limited to 'src-tauri/src/core/auth.rs')
| -rw-r--r-- | src-tauri/src/core/auth.rs | 28 |
1 files changed, 28 insertions, 0 deletions
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<Option<OfflineAccount>>, +} + +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() +} |