mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
change FullDeviceStatus.method into an enum
This commit is contained in:
committed by
Suyog Tandel
parent
83acb4474b
commit
c20c99cd44
@@ -4,7 +4,8 @@ pub mod hid;
|
||||
use crate::{
|
||||
error::PFError,
|
||||
types::{
|
||||
AppConfig, AppConfigInput, DeviceInfo, FidoDeviceInfo, FullDeviceStatus, StoredCredential,
|
||||
AppConfig, AppConfigInput, DeviceInfo, DeviceMethod, FidoDeviceInfo, FullDeviceStatus,
|
||||
StoredCredential,
|
||||
},
|
||||
};
|
||||
use constants::*;
|
||||
@@ -221,7 +222,7 @@ pub fn read_device_details() -> Result<FullDeviceStatus, PFError> {
|
||||
config,
|
||||
secure_boot: false,
|
||||
secure_lock: false,
|
||||
method: "FIDO".to_string(),
|
||||
method: DeviceMethod::FIDO,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -15,10 +15,10 @@ pub fn read_device_details() -> Result<FullDeviceStatus, PFError> {
|
||||
#[tauri::command]
|
||||
pub fn write_config(
|
||||
config: AppConfigInput,
|
||||
method: String,
|
||||
method: DeviceMethod,
|
||||
pin: Option<String>,
|
||||
) -> Result<String, PFError> {
|
||||
if method == "FIDO" {
|
||||
if method == DeviceMethod::FIDO {
|
||||
fido::write_config(config, pin)
|
||||
} else {
|
||||
rescue::write_config(config)
|
||||
|
||||
@@ -235,7 +235,7 @@ pub fn read_device_details() -> Result<FullDeviceStatus, PFError> {
|
||||
config,
|
||||
secure_boot: sb_enabled,
|
||||
secure_lock: sb_locked,
|
||||
method: "Rescue".to_string(),
|
||||
method: DeviceMethod::Rescue,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,13 @@ pub struct FullDeviceStatus {
|
||||
pub config: AppConfig,
|
||||
pub secure_boot: bool,
|
||||
pub secure_lock: bool,
|
||||
pub method: String,
|
||||
pub method: DeviceMethod,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||
pub enum DeviceMethod {
|
||||
FIDO,
|
||||
Rescue,
|
||||
}
|
||||
|
||||
// Fido stuff:
|
||||
|
||||
Reference in New Issue
Block a user