diff --git a/src/agent/src/cdh.rs b/src/agent/src/cdh.rs index 7fe529e471..0476b8f809 100644 --- a/src/agent/src/cdh.rs +++ b/src/agent/src/cdh.rs @@ -10,13 +10,14 @@ use anyhow::Result; use derivative::Derivative; use protocols::{ - sealed_secret, sealed_secret_ttrpc_async, sealed_secret_ttrpc_async::SealedSecretServiceClient, + confidential_data_hub, confidential_data_hub_ttrpc_async, + confidential_data_hub_ttrpc_async::SealedSecretServiceClient, }; use crate::CDH_SOCKET_URI; // Nanoseconds -const CDH_UNSEAL_TIMEOUT: i64 = 50 * 1000 * 1000 * 1000; +const CDH_API_TIMEOUT: i64 = 50 * 1000 * 1000 * 1000; const SEALED_SECRET_PREFIX: &str = "sealed."; #[derive(Derivative)] @@ -30,20 +31,19 @@ impl CDHClient { pub fn new() -> Result { let client = ttrpc::asynchronous::Client::connect(CDH_SOCKET_URI)?; let sealed_secret_client = - sealed_secret_ttrpc_async::SealedSecretServiceClient::new(client); - + confidential_data_hub_ttrpc_async::SealedSecretServiceClient::new(client); Ok(CDHClient { sealed_secret_client, }) } pub async fn unseal_secret_async(&self, sealed_secret: &str) -> Result> { - let mut input = sealed_secret::UnsealSecretInput::new(); + let mut input = confidential_data_hub::UnsealSecretInput::new(); input.set_secret(sealed_secret.into()); let unsealed_secret = self .sealed_secret_client - .unseal_secret(ttrpc::context::with_timeout(CDH_UNSEAL_TIMEOUT), &input) + .unseal_secret(ttrpc::context::with_timeout(CDH_API_TIMEOUT), &input) .await?; Ok(unsealed_secret.plaintext) } @@ -69,7 +69,7 @@ mod tests { use crate::cdh::CDH_ADDR; use anyhow::anyhow; use async_trait::async_trait; - use protocols::{sealed_secret, sealed_secret_ttrpc_async}; + use protocols::{confidential_data_hub, confidential_data_hub_ttrpc_async}; use std::sync::Arc; use test_utils::skip_if_not_root; use tokio::signal::unix::{signal, SignalKind}; @@ -77,13 +77,13 @@ mod tests { struct TestService; #[async_trait] - impl sealed_secret_ttrpc_async::SealedSecretService for TestService { + impl confidential_data_hub_ttrpc_async::SealedSecretService for TestService { async fn unseal_secret( &self, _ctx: &::ttrpc::asynchronous::TtrpcContext, - _req: sealed_secret::UnsealSecretInput, - ) -> ttrpc::error::Result { - let mut output = sealed_secret::UnsealSecretOutput::new(); + _req: confidential_data_hub::UnsealSecretInput, + ) -> ttrpc::error::Result { + let mut output = confidential_data_hub::UnsealSecretOutput::new(); output.set_plaintext("unsealed".into()); Ok(output) } @@ -104,9 +104,9 @@ mod tests { fn start_ttrpc_server() { tokio::spawn(async move { let ss = Box::new(TestService {}) - as Box; + as Box; let ss = Arc::new(ss); - let ss_service = sealed_secret_ttrpc_async::create_sealed_secret_service(ss); + let ss_service = confidential_data_hub_ttrpc_async::create_sealed_secret_service(ss); remove_if_sock_exist(CDH_ADDR).unwrap(); diff --git a/src/libs/protocols/build.rs b/src/libs/protocols/build.rs index 3f14fcd222..a76606b07c 100644 --- a/src/libs/protocols/build.rs +++ b/src/libs/protocols/build.rs @@ -203,7 +203,7 @@ fn real_main() -> Result<(), std::io::Error> { &[ "protos/agent.proto", "protos/health.proto", - "protos/sealed_secret.proto", + "protos/confidential_data_hub.proto", ], true, )?; @@ -211,8 +211,8 @@ fn real_main() -> Result<(), std::io::Error> { fs::rename("src/agent_ttrpc.rs", "src/agent_ttrpc_async.rs")?; fs::rename("src/health_ttrpc.rs", "src/health_ttrpc_async.rs")?; fs::rename( - "src/sealed_secret_ttrpc.rs", - "src/sealed_secret_ttrpc_async.rs", + "src/confidential_data_hub_ttrpc.rs", + "src/confidential_data_hub_ttrpc_async.rs", )?; } @@ -221,7 +221,7 @@ fn real_main() -> Result<(), std::io::Error> { &[ "protos/agent.proto", "protos/health.proto", - "protos/sealed_secret.proto", + "protos/confidential_data_hub.proto", ], false, )?; diff --git a/src/libs/protocols/protos/sealed_secret.proto b/src/libs/protocols/protos/confidential_data_hub.proto similarity index 89% rename from src/libs/protocols/protos/sealed_secret.proto rename to src/libs/protocols/protos/confidential_data_hub.proto index 4e886ab2c4..400607198c 100644 --- a/src/libs/protocols/protos/sealed_secret.proto +++ b/src/libs/protocols/protos/confidential_data_hub.proto @@ -1,5 +1,6 @@ // // Copyright (c) 2024 IBM +// Copyright (c) 2024 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/libs/protocols/src/lib.rs b/src/libs/protocols/src/lib.rs index 9f2c244123..97bbef6f0a 100644 --- a/src/libs/protocols/src/lib.rs +++ b/src/libs/protocols/src/lib.rs @@ -28,8 +28,8 @@ pub use serde_config::{ serialize_message_field, }; -pub mod sealed_secret; -pub mod sealed_secret_ttrpc; +pub mod confidential_data_hub; +pub mod confidential_data_hub_ttrpc; #[cfg(feature = "async")] -pub mod sealed_secret_ttrpc_async; +pub mod confidential_data_hub_ttrpc_async;