Skip to content

Commit

Permalink
AA: kbs: Refactor by creating build request function
Browse files Browse the repository at this point in the history
Split the `rcar_handshake()` method so that the request is now built
by a the new `build_request()` function.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
  • Loading branch information
jodh-intel authored and fidencio committed Sep 10, 2024
1 parent ff54913 commit 62eff62
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions attestation-agent/kbs_protocol/src/client/rcar_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ struct AttestationResponseData {
token: String,
}

async fn build_request(tee: Tee) -> Request {
let extra_params = serde_json::Value::String(String::new());

Request {
version: String::from(KBS_PROTOCOL_VERSION),
tee,
extra_params,
}
}

impl KbsClient<Box<dyn EvidenceProvider>> {
/// Get a [`TeeKeyPair`] and a [`Token`] that certifies the [`TeeKeyPair`].
/// If the client does not already have token or the token is invalid,
Expand Down Expand Up @@ -101,11 +111,7 @@ impl KbsClient<Box<dyn EvidenceProvider>> {
ClientTee::_Initializated(tee) => *tee,
};

let request = Request {
version: String::from(KBS_PROTOCOL_VERSION),
tee,
extra_params: serde_json::Value::String(String::new()),
};
let request = build_request(tee).await;

debug!("send auth request to {auth_endpoint}");

Expand Down

0 comments on commit 62eff62

Please sign in to comment.