HomePhabricator
Diffusion Comm 681c33890287

[services] Tunnelbroker - Adding of gRPC `NewSession` wrapper implementation

Description

[services] Tunnelbroker - Adding of gRPC NewSession wrapper implementation

Summary:
This diff introduces the implementation of NewSession gRPC handler using the Rust Tonic gRPC server by calling the newSessionHandler C++ handler wrapper function.
The new implementation is a wrapper of the current NewSession C++ handler for using and calling from Rust gRPC server codebase.

Linear task: ENG-2059

Test Plan:
1. Building:
The service was successfully built with the CI process or can be built manually using the cargo build command in services/tunnelbroker directory.

2. gRPC testings:
First, run the service using the cargo run command.

Open the gRPC client and call the SessionSignature request with the valid deviceID.
For example:

{
  "deviceID": "mobile:foS4IBADcn3uUNF8DEoH2jj6b8hujMsKUtNAKhJID4U50oalGWyg9rdLpgJwlmRy"
}

The expected result should be the toSign generated string from the server:

{
  "toSign": "7u1iiQNBlrsn0qy9BhlX8BJxttS6cBNnuCtJR1N9Mp8up56Qc4BEZWc9OvJYjlou"
}

Generate a key pair and sign the toSign string by the private key. Then call NewSession gRPC request with the following data:

{
"deviceID" = "mobile:foS4IBADcn3uUNF8DEoH2jj6b8hujMsKUtNAKhJID4U50oalGWyg9rdLpgJwlmRy"
"publicKey = "Your public key"
"signature" = "Signed `toSign` string by your private key from the previous request"
"notifyToken" = "Notification token you can leave it empty"
"deviceType" = "MOBILE"
"deviceAppVersion" = "You can leave it empty for tests"
deviceOS" = "You can leave it empty for tests"
}

The successful response should be the sessionID with the new client session identification.

In case of the wrong signed toSign string, the server will return an error: "Signature for the verification message is not valid".

Reviewers: jon, varun, marcin, tomek

Reviewed By: tomek

Subscribers: ashoat, tomek, atul, abosh

Differential Revision: https://phab.comm.dev/D5490