trust this device to skip 2fa (#9012)

* trust this device to skip 2fa

Signed-off-by: 21pages <sunboeasy@gmail.com>

* Update connection.rs

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
21pages
2024-08-12 18:08:33 +08:00
committed by GitHub
parent 57834840b8
commit 1729ee337f
64 changed files with 845 additions and 22 deletions

View File

@@ -1471,3 +1471,28 @@ pub fn set_unlock_pin(pin: String) -> String {
Err(err) => err.to_string(),
}
}
#[cfg(feature = "flutter")]
pub fn get_trusted_devices() -> String {
#[cfg(any(target_os = "android", target_os = "ios"))]
return Config::get_trusted_devices_json();
#[cfg(not(any(target_os = "android", target_os = "ios")))]
return ipc::get_trusted_devices();
}
#[cfg(feature = "flutter")]
pub fn remove_trusted_devices(json: &str) {
let hwids = serde_json::from_str::<Vec<Bytes>>(json).unwrap_or_default();
#[cfg(any(target_os = "android", target_os = "ios"))]
Config::remove_trusted_devices(&hwids);
#[cfg(not(any(target_os = "android", target_os = "ios")))]
ipc::remove_trusted_devices(hwids);
}
#[cfg(feature = "flutter")]
pub fn clear_trusted_devices() {
#[cfg(any(target_os = "android", target_os = "ios"))]
Config::clear_trusted_devices();
#[cfg(not(any(target_os = "android", target_os = "ios")))]
ipc::clear_trusted_devices();
}