diff --git a/Cargo.toml b/Cargo.toml index 6a30c75..bb830f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nethsm-sdk-rs" -version = "0.1.0" +version = "0.3.0" authors = ["Nitrokey "] description = "All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. " license = "MIT" @@ -15,9 +15,9 @@ exclude = [ ] [dependencies] -serde = "^1.0" +serde = { default-features = false, version = "^1.0" } serde_derive = "^1.0" -serde_json = "^1.0" +serde_json = { default-features = false, version = "^1.0" } url = "^2.2" -ureq = { version = "2", features = ["json"] } -base64ct = { version = "1.6", features = ["alloc"] } +ureq = { version = "2", features = ["json", "tls"], default-features = false } +base64 = { version = "0.21", default-features = false } diff --git a/docs/SystemInfo.md b/docs/SystemInfo.md index 3d831ed..8b3dc39 100644 --- a/docs/SystemInfo.md +++ b/docs/SystemInfo.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **firmware_version** | **String** | | **software_version** | **String** | | **hardware_version** | **String** | | -**build_tag** | **String** | | +**software_build** | Option<**String**> | | [optional] **device_id** | **String** | | **pcr** | [**serde_json::Value**](.md) | | **ak_pub** | [**serde_json::Value**](.md) | | diff --git a/generator/src/main/resources/crust/Cargo.mustache b/generator/src/main/resources/crust/Cargo.mustache index f1b7095..1761afc 100644 --- a/generator/src/main/resources/crust/Cargo.mustache +++ b/generator/src/main/resources/crust/Cargo.mustache @@ -32,12 +32,12 @@ homepage = "{{.}} {{/homePageUrl}} [dependencies] -serde = "^1.0" -serde_derive = "^1.0" {{#serdeWith}} serde_with = "^2.0" {{/serdeWith}} -serde_json = "^1.0" +serde = { default-features = false, version = "^1.0" } +serde_derive = "^1.0" +serde_json = { default-features = false, version = "^1.0" } url = "^2.2" -ureq = { version = "2", features = ["json"] } -base64ct = { version = "1.6", features = ["alloc"] } +ureq = { version = "2", features = ["json", "tls"], default-features = false } +base64 = { version = "0.21", default-features = false } diff --git a/generator/src/main/resources/crust/reqwest/api_mod.mustache b/generator/src/main/resources/crust/reqwest/api_mod.mustache index 154ecdf..4e3b562 100644 --- a/generator/src/main/resources/crust/reqwest/api_mod.mustache +++ b/generator/src/main/resources/crust/reqwest/api_mod.mustache @@ -1,8 +1,7 @@ use std::error; use std::fmt; use std::collections::HashMap; - -use base64ct::{Base64, Encoding}; +use base64::{engine::general_purpose, Engine}; pub (crate) fn get_header_map(response : &ureq::Response) -> HashMap { @@ -111,7 +110,7 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String pub(crate) fn basic_auth(auth: &configuration::BasicAuth) -> String { let string = format!("{}:{}", auth.0, auth.1.as_ref().unwrap_or(&"".to_string())); - format!("Basic {}", Base64::encode_string(string.as_bytes())) + format!("Basic {}", general_purpose::STANDARD.encode(string)).to_string() } {{#apiInfo}} diff --git a/src/apis/mod.rs b/src/apis/mod.rs index 0fc5df9..a203487 100644 --- a/src/apis/mod.rs +++ b/src/apis/mod.rs @@ -1,9 +1,8 @@ +use base64::{engine::general_purpose, Engine}; use std::collections::HashMap; use std::error; use std::fmt; -use base64ct::{Base64, Encoding}; - pub(crate) fn get_header_map(response: &ureq::Response) -> HashMap { let mut headers = HashMap::new(); @@ -111,7 +110,7 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String pub(crate) fn basic_auth(auth: &configuration::BasicAuth) -> String { let string = format!("{}:{}", auth.0, auth.1.as_ref().unwrap_or(&"".to_string())); - format!("Basic {}", Base64::encode_string(string.as_bytes())) + format!("Basic {}", general_purpose::STANDARD.encode(string)).to_string() } pub mod default_api; diff --git a/src/models/system_info.rs b/src/models/system_info.rs index 32f38a5..f1c0c6f 100644 --- a/src/models/system_info.rs +++ b/src/models/system_info.rs @@ -16,8 +16,8 @@ pub struct SystemInfo { pub software_version: String, #[serde(rename = "hardwareVersion")] pub hardware_version: String, - #[serde(rename = "buildTag")] - pub build_tag: String, + #[serde(rename = "softwareBuild", skip_serializing_if = "Option::is_none")] + pub software_build: Option, #[serde(rename = "deviceId")] pub device_id: String, #[serde(rename = "pcr")] @@ -31,7 +31,6 @@ impl SystemInfo { firmware_version: String, software_version: String, hardware_version: String, - build_tag: String, device_id: String, pcr: serde_json::Value, ak_pub: serde_json::Value, @@ -40,7 +39,7 @@ impl SystemInfo { firmware_version, software_version, hardware_version, - build_tag, + software_build: None, device_id, pcr, ak_pub,