From f8025a80cee692d7a3c44ae46a03211d5fa874ca Mon Sep 17 00:00:00 2001 From: Xynnn007 Date: Tue, 4 Jun 2024 16:12:55 +0800 Subject: [PATCH] Types: extend `extra_params` to Value serde_json::Value is a flexible structure that could be a string and even a nested map. This helps us to give more structured context of the message. https://github.com/confidential-containers/trustee/issues/242 is an example issue Signed-off-by: Xynnn007 --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 33671ca..58665b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ extern crate alloc; #[cfg(all(feature = "alloc", not(feature = "std")))] use alloc::string::String; +use serde_json::Value; #[cfg(feature = "std")] use std::string::String; @@ -45,14 +46,14 @@ pub struct Request { pub version: String, pub tee: Tee, #[serde(rename = "extra-params")] - pub extra_params: String, + pub extra_params: Value, } #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Challenge { pub nonce: String, #[serde(rename = "extra-params")] - pub extra_params: String, + pub extra_params: Value, } #[derive(Clone, Serialize, Deserialize, Debug)] @@ -70,7 +71,7 @@ pub struct Attestation { #[serde(rename = "tee-pubkey")] pub tee_pubkey: TeePubKey, #[serde(rename = "tee-evidence")] - pub tee_evidence: String, + pub tee_evidence: Value, } #[derive(Clone, Serialize, Deserialize, Debug)]