@@ -9,6 +9,9 @@ use serde::{Deserialize, Serialize};
99use serde_json:: { from_str, Value } ;
1010use sha2:: Digest ;
1111
12+ #[ cfg( feature = "borsh" ) ]
13+ use borsh:: { BorshDeserialize , BorshSerialize } ;
14+
1215const INIT_MR : & str = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ;
1316
1417fn replay_rtmr ( history : Vec < String > ) -> Result < String , FromHexError > {
@@ -29,6 +32,7 @@ fn replay_rtmr(history: Vec<String>) -> Result<String, FromHexError> {
2932
3033/// Represents an event log entry in the system
3134#[ derive( Debug , Serialize , Deserialize ) ]
35+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
3236pub struct EventLog {
3337 /// The index of the IMR (Integrity Measurement Register)
3438 pub imr : u32 ,
@@ -43,7 +47,8 @@ pub struct EventLog {
4347}
4448
4549/// Configuration for TLS key generation
46- #[ derive( Debug , bon:: Builder , Serialize ) ]
50+ #[ derive( Debug , bon:: Builder , Serialize , Deserialize ) ]
51+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
4752pub struct TlsKeyConfig {
4853 /// The subject name for the certificate
4954 #[ builder( into, default = String :: new( ) ) ]
@@ -64,6 +69,7 @@ pub struct TlsKeyConfig {
6469
6570/// Response containing a key and its signature chain
6671#[ derive( Debug , Serialize , Deserialize ) ]
72+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
6773pub struct GetKeyResponse {
6874 /// The key in hexadecimal format
6975 pub key : String ,
@@ -83,6 +89,7 @@ impl GetKeyResponse {
8389
8490/// Response containing a quote and associated event log
8591#[ derive( Debug , Serialize , Deserialize ) ]
92+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
8693pub struct GetQuoteResponse {
8794 /// The attestation quote in hexadecimal format
8895 pub quote : String ,
@@ -122,6 +129,7 @@ impl GetQuoteResponse {
122129
123130/// Response containing instance information and attestation data
124131#[ derive( Debug , Serialize , Deserialize ) ]
132+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
125133pub struct InfoResponse {
126134 /// The application identifier
127135 pub app_id : String ,
@@ -157,6 +165,7 @@ impl InfoResponse {
157165
158166/// Trusted Computing Base information structure
159167#[ derive( Debug , Serialize , Deserialize ) ]
168+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
160169pub struct TcbInfo {
161170 /// The measurement root of trust
162171 pub mrtd : String ,
@@ -183,6 +192,7 @@ pub struct TcbInfo {
183192
184193/// Response containing TLS key and certificate chain
185194#[ derive( Debug , Serialize , Deserialize ) ]
195+ #[ cfg_attr( feature = "borsh" , derive( BorshSerialize , BorshDeserialize ) ) ]
186196pub struct GetTlsKeyResponse {
187197 /// The TLS key in hexadecimal format
188198 pub key : String ,
0 commit comments