Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3491111
D5838.id20181.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5838.id20181.diff
View Options
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,6 +1,8 @@
+use super::tunnelbroker_utils::proto::new_session_request::DeviceTypes;
use crate::tools::Error;
use crate::tunnelbroker::tunnelbroker_utils::{
- proto::SessionSignatureRequest, TunnelbrokerServiceClient,
+ proto::NewSessionRequest, proto::SessionSignatureRequest,
+ TunnelbrokerServiceClient,
};
use openssl::hash::MessageDigest;
use openssl::pkey::PKey;
@@ -28,3 +30,28 @@
let signature = signer.sign_to_vec()?;
Ok(base64::encode(signature))
}
+
+pub async fn create_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
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 6:17 PM (11 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676855
Default Alt Text
D5838.id20181.diff (1 KB)
Attached To
Mode
D5838: [services/commtest] Tunnelbroker - Adding of helper function for the `NewSession` client request
Attached
Detach File
Event Timeline
Log In to Comment