diff --git a/services/commtest/src/lib.rs b/services/commtest/src/lib.rs index 45d03b1f1..e1b687e59 100644 --- a/services/commtest/src/lib.rs +++ b/services/commtest/src/lib.rs @@ -1,4 +1,5 @@ pub mod backup; pub mod blob; pub mod constants; pub mod tools; +pub mod tunnelbroker; diff --git a/services/commtest/src/tunnelbroker/mod.rs b/services/commtest/src/tunnelbroker/mod.rs new file mode 100644 index 000000000..43c680180 --- /dev/null +++ b/services/commtest/src/tunnelbroker/mod.rs @@ -0,0 +1,2 @@ +pub mod new_session; +pub mod tunnelbroker_utils; diff --git a/services/commtest/src/tunnelbroker/new_session.rs b/services/commtest/src/tunnelbroker/new_session.rs new file mode 100644 index 000000000..c18ba52be --- /dev/null +++ b/services/commtest/src/tunnelbroker/new_session.rs @@ -0,0 +1,17 @@ +use crate::tools::Error; +use crate::tunnelbroker::tunnelbroker_utils::{ + proto::SessionSignatureRequest, TunnelbrokerServiceClient, +}; +use tonic::Request; + +pub async fn get_string_to_sign( + client: &mut TunnelbrokerServiceClient, + device_id: &str, +) -> Result { + let response = client + .session_signature(Request::new(SessionSignatureRequest { + device_id: String::from(device_id), + })) + .await?; + Ok(response.into_inner().to_sign) +} diff --git a/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs b/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs new file mode 100644 index 000000000..cfe256251 --- /dev/null +++ b/services/commtest/src/tunnelbroker/tunnelbroker_utils.rs @@ -0,0 +1,4 @@ +pub mod proto { + tonic::include_proto!("tunnelbroker"); +} +pub use proto::tunnelbroker_service_client::TunnelbrokerServiceClient;