Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33317769
D5967.1768833574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D5967.1768833574.diff
View Options
diff --git a/native/native_rust_library/src/identity_client.rs b/native/native_rust_library/src/identity_client.rs
--- a/native/native_rust_library/src/identity_client.rs
+++ b/native/native_rust_library/src/identity_client.rs
@@ -34,11 +34,11 @@
VerifyUserTokenRequest, WalletLoginRequest as WalletLoginRequestStruct,
WalletLoginResponse as WalletLoginResponseStruct,
};
+use crate::IdentityClient;
use comm_opaque::Cipher;
-use crate::Client;
pub async fn get_user_id(
- mut client: Box<Client>,
+ mut client: Box<IdentityClient>,
auth_type: i32,
user_info: String,
) -> Result<String, Status> {
@@ -56,7 +56,7 @@
}
pub async fn verify_user_token(
- mut client: Box<Client>,
+ mut client: Box<IdentityClient>,
user_id: String,
device_id: String,
access_token: String,
@@ -76,7 +76,7 @@
}
pub async fn register_user(
- mut client: Box<Client>,
+ mut client: Box<IdentityClient>,
user_id: String,
device_id: String,
username: String,
@@ -138,7 +138,7 @@
}
pub async fn login_user_pake(
- mut client: Box<Client>,
+ mut client: Box<IdentityClient>,
user_id: String,
device_id: String,
password: String,
@@ -202,7 +202,7 @@
}
pub async fn login_user_wallet(
- mut client: Box<Client>,
+ mut client: Box<IdentityClient>,
user_id: String,
device_id: String,
siwe_message: String,
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -17,8 +17,6 @@
verify_user_token,
};
-const IDENTITY_SERVICE_SOCKET_ADDR: &str = "https://[::1]:50051";
-
lazy_static! {
pub static ref RUNTIME: Arc<Runtime> = Arc::new(
Builder::new_multi_thread()
@@ -41,21 +39,21 @@
extern "Rust" {
// Identity Service Client
- type Client;
- fn initialize_client() -> Box<Client>;
+ type IdentityClient;
+ fn initialize_identity_client(addr: String) -> Box<IdentityClient>;
fn get_user_id_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
auth_type: i32,
user_info: String,
) -> Result<String>;
fn verify_user_token_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
access_token: String,
) -> Result<bool>;
fn register_user_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
username: String,
@@ -63,14 +61,14 @@
user_public_key: String,
) -> Result<String>;
fn login_user_pake_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
password: String,
user_public_key: String,
) -> Result<String>;
fn login_user_wallet_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
siwe_message: String,
@@ -83,21 +81,21 @@
}
#[derive(Debug)]
-pub struct Client {
+pub struct IdentityClient {
identity_client: IdentityServiceClient<Channel>,
}
-fn initialize_client() -> Box<Client> {
- Box::new(Client {
+fn initialize_identity_client(addr: String) -> Box<IdentityClient> {
+ Box::new(IdentityClient {
identity_client: RUNTIME
- .block_on(IdentityServiceClient::connect(IDENTITY_SERVICE_SOCKET_ADDR))
+ .block_on(IdentityServiceClient::connect(addr))
.unwrap(),
})
}
#[instrument]
fn get_user_id_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
auth_type: i32,
user_info: String,
) -> Result<String, Status> {
@@ -106,7 +104,7 @@
#[instrument]
fn verify_user_token_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
access_token: String,
@@ -116,7 +114,7 @@
#[instrument]
fn register_user_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
username: String,
@@ -135,7 +133,7 @@
#[instrument]
fn login_user_pake_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
password: String,
@@ -152,7 +150,7 @@
#[instrument]
fn login_user_wallet_blocking(
- client: Box<Client>,
+ client: Box<IdentityClient>,
user_id: String,
device_id: String,
siwe_message: String,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 2:39 PM (4 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5956260
Default Alt Text
D5967.1768833574.diff (4 KB)
Attached To
Mode
D5967: [native/rust_library] Refactor Tonic client function name for Identity service
Attached
Detach File
Event Timeline
Log In to Comment