Skip to content

Commit 3b0681d

Browse files
committed
Rename GetAttestation to GetAttestationForAppKey
1 parent 7bf23b4 commit 3b0681d

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

guest-agent/rpc/proto/agent_rpc.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ service Worker {
220220
// Get the guest agent version
221221
rpc Version(google.protobuf.Empty) returns (WorkerVersion) {}
222222
// Get attestation
223-
rpc GetAttestation(GetAttestationRequest) returns (GetQuoteResponse) {}
223+
rpc GetAttestationForAppKey(GetAttestationForAppKeyRequest) returns (GetQuoteResponse) {}
224224
}
225225

226226
message SignRequest {
@@ -232,6 +232,6 @@ message SignResponse {
232232
bytes signature = 1;
233233
}
234234

235-
message GetAttestationRequest {
235+
message GetAttestationForAppKeyRequest {
236236
string algorithm = 1;
237237
}

guest-agent/src/rpc_service.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use dstack_guest_agent_rpc::{
1010
dstack_guest_server::{DstackGuestRpc, DstackGuestServer},
1111
tappd_server::{TappdRpc, TappdServer},
1212
worker_server::{WorkerRpc, WorkerServer},
13-
AppInfo, DeriveK256KeyResponse, DeriveKeyArgs, EmitEventArgs, GetAttestationRequest,
13+
AppInfo, DeriveK256KeyResponse, DeriveKeyArgs, EmitEventArgs, GetAttestationForAppKeyRequest,
1414
GetKeyArgs, GetKeyResponse, GetQuoteResponse, GetTlsKeyArgs, GetTlsKeyResponse, RawQuoteArgs,
1515
SignRequest, SignResponse, TdxQuoteArgs, TdxQuoteResponse, WorkerVersion,
1616
};
@@ -489,7 +489,10 @@ impl WorkerRpc for ExternalRpcHandler {
489489
})
490490
}
491491

492-
async fn get_attestation(self, request: GetAttestationRequest) -> Result<GetQuoteResponse> {
492+
async fn get_attestation_for_app_key(
493+
self,
494+
request: GetAttestationForAppKeyRequest,
495+
) -> Result<GetQuoteResponse> {
493496
match request.algorithm.as_str() {
494497
"ed25519" => Ok(self.state.inner.ed25519_attestation.clone()),
495498
"secp256k1" => Ok(self.state.inner.secp256k1_attestation.clone()),
@@ -512,7 +515,7 @@ impl RpcCall<AppState> for ExternalRpcHandler {
512515
mod tests {
513516
use super::*;
514517
use crate::config::{AppComposeWrapper, Config, Simulator};
515-
use dstack_guest_agent_rpc::{GetAttestationRequest, SignRequest};
518+
use dstack_guest_agent_rpc::{GetAttestationForAppKeyRequest, SignRequest};
516519
use dstack_types::{AppCompose, AppKeys, DockerConfig, KeyProvider};
517520
use ed25519_dalek::{Signature as Ed25519Signature, Verifier};
518521
use k256::ecdsa::{Signature as K256Signature, VerifyingKey};
@@ -725,40 +728,40 @@ pNs85uhOZE8z2jr8Pg==
725728
}
726729

727730
#[tokio::test]
728-
async fn test_get_attestation_ed25519_success() {
731+
async fn test_get_attestation_for_app_key_ed25519_success() {
729732
let state = setup_test_state().await;
730733
let handler = ExternalRpcHandler::new(state.clone());
731-
let request = GetAttestationRequest {
734+
let request = GetAttestationForAppKeyRequest {
732735
algorithm: "ed25519".to_string(),
733736
};
734737

735-
let response = handler.get_attestation(request).await.unwrap();
738+
let response = handler.get_attestation_for_app_key(request).await.unwrap();
736739

737740
assert_eq!(response, state.inner.ed25519_attestation);
738741
}
739742

740743
#[tokio::test]
741-
async fn test_get_attestation_secp256k1_success() {
744+
async fn test_get_attestation_for_app_key_secp256k1_success() {
742745
let state = setup_test_state().await;
743746
let handler = ExternalRpcHandler::new(state.clone());
744-
let request = GetAttestationRequest {
747+
let request = GetAttestationForAppKeyRequest {
745748
algorithm: "secp256k1".to_string(),
746749
};
747750

748-
let response = handler.get_attestation(request).await.unwrap();
751+
let response = handler.get_attestation_for_app_key(request).await.unwrap();
749752

750753
assert_eq!(response, state.inner.secp256k1_attestation);
751754
}
752755

753756
#[tokio::test]
754-
async fn test_get_attestation_unsupported_algorithm_fails() {
757+
async fn test_get_attestation_for_app_key_unsupported_algorithm_fails() {
755758
let state = setup_test_state().await;
756759
let handler = ExternalRpcHandler::new(state);
757-
let request = GetAttestationRequest {
760+
let request = GetAttestationForAppKeyRequest {
758761
algorithm: "ecdsa".to_string(), // Unsupported algorithm
759762
};
760763

761-
let result = handler.get_attestation(request).await;
764+
let result = handler.get_attestation_for_app_key(request).await;
762765
assert!(result.is_err());
763766
assert_eq!(result.unwrap_err().to_string(), "Unsupported algorithm");
764767
}

0 commit comments

Comments
 (0)