@@ -57,24 +57,23 @@ pub async fn create_azure_attestation(
5757 let quote_b64 = BASE64_URL_SAFE . encode ( & td_quote_bytes) ;
5858 let runtime_b64 = BASE64_URL_SAFE . encode ( hcl_var_data) ;
5959
60- let body = TdxVmRequest {
60+ let tdx_vm_request = TdxVmRequest {
6161 quote : quote_b64,
6262 runtime_data : Some ( RuntimeData {
6363 data : runtime_b64,
6464 data_type : "Binary" ,
6565 } ) ,
66- nonce : Some ( "my-app-nonce-or-session-id" . to_string ( ) ) ,
66+ nonce : Some ( "my-app-nonce-or-session-id" . to_string ( ) ) , // TODO
6767 } ;
68- let body_bytes = serde_json:: to_vec ( & body) ?;
69- let jwt_token = call_tdxvm_attestation ( maa_endpoint, aad_access_token, body_bytes) . await ?;
68+ let jwt_token = call_tdxvm_attestation ( maa_endpoint, aad_access_token, & tdx_vm_request) . await ?;
7069 Ok ( jwt_token. as_bytes ( ) . to_vec ( ) )
7170}
7271
7372/// Get a signed JWT from the azure API
7473async fn call_tdxvm_attestation (
7574 maa_endpoint : String ,
7675 aad_access_token : String ,
77- body_bytes : Vec < u8 > ,
76+ tdx_vm_request : & TdxVmRequest < ' _ > ,
7877) -> Result < String , MaaError > {
7978 let url = format ! ( "{}/attest/TdxVm?api-version=2025-06-01" , maa_endpoint) ;
8079
@@ -83,7 +82,7 @@ async fn call_tdxvm_attestation(
8382 . post ( & url)
8483 . bearer_auth ( & aad_access_token)
8584 . header ( "Content-Type" , "application/json" )
86- . body ( body_bytes )
85+ . body ( serde_json :: to_vec ( tdx_vm_request ) ? )
8786 . send ( )
8887 . await ?;
8988
0 commit comments