Compare commits
3 Commits
a21abe86bb
...
f214aa454e
Author | SHA1 | Date | |
---|---|---|---|
f214aa454e | |||
9d2599dd2f | |||
eddaaaaa2f |
@@ -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
|
||||
}
|
||||
|
@@ -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};
|
||||
|
Reference in New Issue
Block a user