diff --git a/src-tauri/src/fido/constants.rs b/src-tauri/src/fido/constants.rs index eb1983a..5be640c 100644 --- a/src-tauri/src/fido/constants.rs +++ b/src-tauri/src/fido/constants.rs @@ -154,7 +154,7 @@ pub enum VendorConfigCommand { } impl VendorConfigCommand { - pub fn to_u64(&self) -> u64 { + pub fn to_u64(self) -> u64 { match self { Self::AuthEncryptionEnable => 0x03e43f56b34285e2, Self::AuthEncryptionDisable => 0x1831a40f04a25ed9, diff --git a/src-tauri/src/fido/mod.rs b/src-tauri/src/fido/mod.rs index 0d9ea09..14c4b12 100644 --- a/src-tauri/src/fido/mod.rs +++ b/src-tauri/src/fido/mod.rs @@ -222,7 +222,7 @@ pub fn read_device_details() -> Result { config, secure_boot: false, secure_lock: false, - method: DeviceMethod::FIDO, + method: DeviceMethod::Fido, }) } @@ -394,7 +394,7 @@ pub fn write_config(config: AppConfigInput, pin: Option) -> Result, ) -> Result { - if method == DeviceMethod::FIDO { + if method == DeviceMethod::Fido { fido::write_config(config, pin) } else { rescue::write_config(config) diff --git a/src-tauri/src/rescue/mod.rs b/src-tauri/src/rescue/mod.rs index 1608738..dfbbf78 100644 --- a/src-tauri/src/rescue/mod.rs +++ b/src-tauri/src/rescue/mod.rs @@ -6,7 +6,6 @@ pub mod constants; use crate::{error::PFError, rescue::constants::*, types::*}; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use log; use pcsc::{Context, Protocols, Scope, ShareMode}; use std::io::Cursor; @@ -322,19 +321,17 @@ pub fn write_config(config: AppConfigInput) -> Result { } // Product Name (Tag 0x09) - if let Some(name) = config.product_name { - if !name.is_empty() { - let name_bytes = name.as_bytes(); - let len = name_bytes.len() + 1; - if len > 32 { - return Err(PFError::Io("Product name too long".into())); - } - - tlv.push(PhyTag::UsbProduct as u8); - tlv.push(len as u8); - tlv.extend_from_slice(name_bytes); - tlv.push(0x00); // Null terminator + if let Some(name) = config.product_name.filter(|n| !n.is_empty()) { + let name_bytes = name.as_bytes(); + let len = name_bytes.len() + 1; + if len > 32 { + return Err(PFError::Io("Product name too long".into())); } + + tlv.push(PhyTag::UsbProduct as u8); + tlv.push(len as u8); + tlv.extend_from_slice(name_bytes); + tlv.push(0x00); // Null terminator } // 2. Connect and Send diff --git a/src-tauri/src/types.rs b/src-tauri/src/types.rs index 9edfdc2..cbff91e 100644 --- a/src-tauri/src/types.rs +++ b/src-tauri/src/types.rs @@ -60,7 +60,8 @@ pub struct FullDeviceStatus { #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub enum DeviceMethod { - FIDO, + #[serde(rename = "FIDO")] + Fido, Rescue, }