Fixes Patches Creation & More

Working with files / Paths fixed

Websocket PingPongs (There is no data behind this just PingPong)

Storing User Profiles correctly

Added necessary dependencies and initial code support for: - X.509
certificate handling via x509/pkcs8 crates - Key generation and crypto
operations via x448/sha2 - Structured hex encoding and base64 encoding
This commit is contained in:
Alex Emmet 2025-09-23 20:26:48 +00:00
commit 0d07ddf851
23 changed files with 887 additions and 266 deletions

View file

@ -18,8 +18,8 @@ pub fn mod_user(storage_owner: Uuid, contact: &Contact) {
};
for i in 0..contacts.len() {
if contacts[i]["userID"].as_str() == Some(&contact.user_id.unwrap().to_string()) {
contacts.remove(stringify!("{}", i));
if contacts[i]["user_id"].as_str() == Some(&contact.user_id.unwrap().to_string()) {
contacts.array_remove(i);
break;
}
}
@ -37,7 +37,7 @@ pub fn get_user(storage_owner: Uuid, user_id: Uuid) -> Option<Contact> {
if let Ok(contacts) = json::parse(&s) {
for i in 0..contacts.len() {
if let Some(uid) = contacts[i]["userID"].as_str() {
if let Some(uid) = contacts[i]["user_id"].as_str() {
if Uuid::parse_str(uid).ok()? == user_id {
return Option::from(Contact::from_json(&contacts[i]));
}

View file

@ -1,9 +1,13 @@
use crate::util::file_util::{load_file, save_file};
use json::JsonValue;
use once_cell::sync::Lazy;
use std::fs::{self, File};
use std::path::Path;
use std::sync::Mutex;
use uuid::Uuid;
pub static CONFIG: Lazy<Mutex<ConfigUtil>> = Lazy::new(|| Mutex::new(ConfigUtil::new()));
pub struct ConfigUtil {
pub config: JsonValue,
pub unique: bool,
@ -24,6 +28,14 @@ impl ConfigUtil {
}
}
pub fn get_iota_id(&self) -> Uuid {
self.config["iota_id"]
.as_str()
.unwrap_or_default()
.parse()
.unwrap_or_default()
}
pub fn change(&mut self, key: &str, value: Uuid) {
self.config[key] = JsonValue::String(value.to_string());
self.unique = true;

View file

@ -1,4 +1,4 @@
pub mod file_util;
pub mod chat_files;
pub mod chats_util;
pub mod config_util;
pub mod chats_util;
pub mod file_util;