diff --git a/client/hwlib/src/lib.rs b/client/hwlib/src/lib.rs index 6cb6e85b..68f797b1 100644 --- a/client/hwlib/src/lib.rs +++ b/client/hwlib/src/lib.rs @@ -1,10 +1,13 @@ use rand::Rng; mod models; use models::devices; +use models::rbody::{ + CertificationStatusResponse, CertifiedResponse, NotSeenResponse, + RelatedCertifiedSystemExistsResponse, +}; use models::software; -use models::rbody::{RelatedCertifiedSystemExistsResponse, CertifiedResponse, NotSeenResponse, CertificationStatusResponse}; -fn get_certified_system_sample() -> CertifiedResponse{ +fn get_certified_system_sample() -> CertifiedResponse { let kernel_package = software::KernelPackageValidator { name: "Linux".to_string(), version: "5.4.0-42-generic".to_string(), @@ -88,13 +91,16 @@ fn get_related_certified_system_exists_sample() -> RelatedCertifiedSystemExistsR } } - -pub async fn get_certification_status(_url: &str) -> Result { +pub async fn get_certification_status( + _url: &str, +) -> Result { let mut rng = rand::thread_rng(); let response_type = rng.gen_range(0..3); let response = match response_type { 0 => CertificationStatusResponse::Certified(get_certified_system_sample()), - 1 => CertificationStatusResponse::RelatedCertifiedSystemExists(get_related_certified_system_exists_sample()), + 1 => CertificationStatusResponse::RelatedCertifiedSystemExists( + get_related_certified_system_exists_sample(), + ), _ => CertificationStatusResponse::NotSeen(NotSeenResponse { status: "Not Seen".to_string(), }), diff --git a/client/hwlib/src/models/devices.rs b/client/hwlib/src/models/devices.rs index c3b178ac..abfd8317 100644 --- a/client/hwlib/src/models/devices.rs +++ b/client/hwlib/src/models/devices.rs @@ -1,5 +1,4 @@ -use serde::{Serialize, Deserialize}; - +use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] pub struct AudioValidator { @@ -7,7 +6,6 @@ pub struct AudioValidator { pub vendor: String, } - #[derive(Serialize, Deserialize)] pub struct BiosValidator { pub firmware_revision: String, @@ -17,15 +15,13 @@ pub struct BiosValidator { pub version: String, } - #[derive(Serialize, Deserialize)] pub struct BoardValidator { pub manufacturer: String, pub product_name: String, - pub version: String + pub version: String, } - #[derive(Serialize, Deserialize)] pub struct ChassisValidator { pub chassis_type: String, @@ -43,7 +39,6 @@ pub struct GPUValidator { #[derive(Serialize, Deserialize)] pub struct NetworkAdapterValidator { - pub bus: String, pub id: String, pub model: String, @@ -75,14 +70,12 @@ pub struct USBPeripheralValidator { #[derive(Serialize, Deserialize)] pub struct VideoCaptureValidator { - pub model: String, pub vendor: String, } #[derive(Serialize, Deserialize)] pub struct WirelessAdapterValidator { - pub model: String, pub vendor: String, } diff --git a/client/hwlib/src/models/mod.rs b/client/hwlib/src/models/mod.rs index 397a5dae..c3ac294c 100644 --- a/client/hwlib/src/models/mod.rs +++ b/client/hwlib/src/models/mod.rs @@ -1,3 +1,3 @@ pub mod devices; -pub mod software; pub mod rbody; +pub mod software; diff --git a/client/hwlib/src/models/rbody.rs b/client/hwlib/src/models/rbody.rs index 408ed676..278c84e3 100644 --- a/client/hwlib/src/models/rbody.rs +++ b/client/hwlib/src/models/rbody.rs @@ -1,4 +1,4 @@ -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use crate::models::devices; use crate::models::software; diff --git a/client/hwlib/src/models/software.rs b/client/hwlib/src/models/software.rs index b1f8a244..703c952e 100644 --- a/client/hwlib/src/models/software.rs +++ b/client/hwlib/src/models/software.rs @@ -1,4 +1,4 @@ -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct KernelPackageValidator {