Page MenuHomePhabricator

D5838.id19208.diff
No OneTemporary

D5838.id19208.diff

diff --git a/services/commtest/src/tunnelbroker/new_session.rs b/services/commtest/src/tunnelbroker/new_session.rs
--- a/services/commtest/src/tunnelbroker/new_session.rs
+++ b/services/commtest/src/tunnelbroker/new_session.rs
@@ -1,9 +1,12 @@
use crate::tools::Error;
use crate::tunnelbroker::tunnelbroker_utils::{
- proto::SessionSignatureRequest, TunnelbrokerServiceClient,
+ proto::NewSessionRequest, proto::SessionSignatureRequest,
+ TunnelbrokerServiceClient,
};
use tonic::Request;
+use super::tunnelbroker_utils::proto::new_session_request::DeviceTypes;
+
pub async fn get_session_signature(
client: &mut TunnelbrokerServiceClient<tonic::transport::Channel>,
device_id: &str,
@@ -16,3 +19,28 @@
let string_to_sign = response.into_inner().to_sign;
Ok(string_to_sign)
}
+
+pub async fn new_session(
+ client: &mut TunnelbrokerServiceClient<tonic::transport::Channel>,
+ device_id: &str,
+ public_key: &str,
+ signature: &str,
+ notify_token: &str,
+ device_type: DeviceTypes,
+ device_app_version: &str,
+ device_os: &str,
+) -> Result<String, Error> {
+ let response = client
+ .new_session(Request::new(NewSessionRequest {
+ device_id: device_id.to_string(),
+ public_key: public_key.to_string(),
+ signature: signature.to_string(),
+ notify_token: Some(notify_token.to_string()),
+ device_type: device_type as i32,
+ device_app_version: device_app_version.to_string(),
+ device_os: device_os.to_string(),
+ }))
+ .await?;
+ let session_id = response.into_inner().session_id;
+ Ok(session_id)
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 6:17 PM (10 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678333
Default Alt Text
D5838.id19208.diff (1 KB)

Event Timeline