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 @@ -1,3 +1,5 @@ +use crypto_tools::generate_device_id; +use identity::identity_service_client::IdentityServiceClient; use lazy_static::lazy_static; use std::sync::Arc; use tokio::runtime::{Builder, Runtime}; @@ -11,9 +13,6 @@ tonic::include_proto!("identity"); } -use crypto_tools::generate_device_id; -use identity::identity_service_client::IdentityServiceClient; - lazy_static! { pub static ref RUNTIME: Arc = Arc::new( Builder::new_multi_thread() @@ -25,9 +24,7 @@ ); } -#[cxx::bridge] mod ffi { - enum DeviceType { KEYSERVER, WEB, @@ -37,18 +34,26 @@ extern "Rust" { // Identity Service Client type IdentityClient; + + #[cxx_name = "identityInitializeClient"] fn initialize_identity_client(addr: String) -> Box; + + #[cxx_name = "identityGetUserIdBlocking"] fn identity_get_user_id_blocking( client: Box, auth_type: i32, user_info: String, ) -> Result; + + #[cxx_name = "identityVerifyUserTokenBlocking"] fn identity_verify_user_token_blocking( client: Box, user_id: String, device_id: String, access_token: String, ) -> Result; + + #[cxx_name = "identityRegisterUserBlocking"] fn identity_register_user_blocking( client: Box, user_id: String, @@ -57,6 +62,8 @@ password: String, user_public_key: String, ) -> Result; + + #[cxx_name = "identityLoginUserPakeBlocking"] fn identity_login_user_pake_blocking( client: Box, user_id: String, @@ -64,6 +71,8 @@ password: String, user_public_key: String, ) -> Result; + + #[cxx_name = "identityLoginUserWalletBlocking"] fn identity_login_user_wallet_blocking( client: Box, user_id: String,