3 Commits

Author SHA1 Message Date
f214aa454e chore: remove todo note 2025-07-16 22:02:13 +02:00
9d2599dd2f chore: code cleanup 2025-07-16 22:01:41 +02:00
eddaaaaa2f fix: add fallback for non windows 2025-07-16 22:01:07 +02:00
2 changed files with 9 additions and 15 deletions

View File

@@ -720,24 +720,20 @@ pub async fn has_net8() -> bool {
is_net8_installed().await
}
/*
* osu!.exe decompile result:
* dpapi cipher is most likely: cu24180ncjeiu0ci1nwui
* dpapi key type is: 1
*
* example call for encryption: DPAPI.Encrypt((DPAPI.KeyType)1, this.storage.UnsecureRepresentation(), "cu24180ncjeiu0ci1nwui", this.representation.ToString());
* the method args are following: Encrypt(DPAPI.KeyType keyType, byte[] plainTextBytes, byte[] entropyBytes, string description)
*/
#[cfg(windows)]
#[tauri::command]
pub fn encrypt_string(string: String, entropy: String) -> String {
let encrypted = encrypt_password(&string, &entropy);
match encrypted {
Ok(encrypted_vec) => {
// encrypted_vec is already a String, not Vec<u8>
encrypted_vec
}
Ok(encrypted_vec) => encrypted_vec,
Err(_) => string,
}
}
// NOTE: should not be called by tauri on non windows systems, return the string nonthenless
#[cfg(not(windows))]
#[tauri::command]
pub fn encrypt_string(string: String, _entropy: String) -> String {
string
}

View File

@@ -308,8 +308,6 @@ pub async fn is_net8_installed() -> bool {
}
}
//TODO: maybe switch to this crate: https://crates.io/crates/windows-dpapi
#[cfg(windows)]
pub fn encrypt_password(password: &str, entropy: &str) -> Result<String, String> {
use base64::{Engine as _, engine::general_purpose};