Local Auth (start of dezentralization)

Prep for WebUI
Upgrade to SSL optional
This commit is contained in:
Alex Emmet 2025-11-16 02:14:02 +01:00
commit 5f40158b00
11 changed files with 456 additions and 73 deletions

19
src/auth/local_auth.rs Normal file
View file

@ -0,0 +1,19 @@
use json::JsonValue;
use uuid::Uuid;
use crate::util::file_util::load_file;
pub fn is_private_key_valid(user_id: &Uuid, key_hash: &str) -> bool {
let file_contents = load_file("", "users.json");
let users = json::parse(&file_contents).unwrap();
if let JsonValue::Array(users_array) = users {
for user in users_array {
if user["uuid"] == user_id.to_string() && user["private_key_hash"] == key_hash {
return true;
}
}
}
false
}

View file

@ -1,2 +1,3 @@
pub mod auth_connector;
pub mod crypto_helper;
pub mod local_auth;