diff --git a/Cargo.lock b/Cargo.lock index f3953ed..34b1bc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -770,9 +770,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a043dc74da1e37d6afe657061213aa6f425f855399a11d3463c6ecccc4dfda1f" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "ff" @@ -2987,9 +2987,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.51.0" +version = "1.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd1c4c0fc4a7ab90fc15ef6daaa3ec3b893f004f915f2392557ed23237820cd" +checksum = "f66bf9585cda4b724d3e78ab34b73fb2bbaba9011b9bfdf69dc836382ea13b8c" dependencies = [ "bytes", "libc", @@ -3133,7 +3133,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "ttp-core" version = "0.1.0" -source = "git+https://git.methanium.net/Tensamin/TTP.git#bacbcb0e38791cf1a38cf5851beb20d5645002ba" +source = "git+https://github.com/Tensamin/TTP.git#e246d1af6a42c71514d0ccc06fef94d71e4ad167" dependencies = [ "base64 0.22.1", "byteorder", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "ttp-native" version = "0.1.0" -source = "git+https://git.methanium.net/Tensamin/TTP.git#bacbcb0e38791cf1a38cf5851beb20d5645002ba" +source = "git+https://github.com/Tensamin/TTP.git#e246d1af6a42c71514d0ccc06fef94d71e4ad167" dependencies = [ "quinn", "rustls", diff --git a/Cargo.toml b/Cargo.toml index c07b798..3127b12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2024" [dependencies] -ttp-core = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-core" } -ttp-native = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-native" } +ttp-core = { git = "https://github.com/Tensamin/TTP.git", package = "ttp-core" } +ttp-native = { git = "https://github.com/Tensamin/TTP.git", package = "ttp-native" } ansi_term = "*" uuid = { version = "*", features = ["v4"] } diff --git a/src/rho/connection.rs b/src/rho/connection.rs index 5b5d831..cde8ee4 100755 --- a/src/rho/connection.rs +++ b/src/rho/connection.rs @@ -96,6 +96,33 @@ impl GeneralConnection { log_out!(0, PrintType::General, "General connection handler stopped"); } async fn handle_identification(self: &Arc, cv: CommunicationValue) { + if cv.is_type(CommunicationType::register_iota) { + if let DataValue::Str(pub_key) = cv.get_data(DataTypes::public_key) { + let msg = CommunicationValue::new(CommunicationType::complete_register_iota) + .add_data(DataTypes::public_key, DataValue::Str(pub_key.clone())); + + let response = get_omega_connection() + .await_response(&msg, Some(Duration::from_secs(20))) + .await; + + if let Ok(response_cv) = response { + if let DataValue::Number(iota_id) = response_cv.get_data(DataTypes::iota_id) { + let success_msg = CommunicationValue::new(CommunicationType::success) + .with_id(cv.get_id()) + .add_data(DataTypes::iota_id, DataValue::Number(*iota_id)); + + log_cv_out!(success_msg); + let _ = self.sender.send(&success_msg).await; + } else { + let err_msg = + CommunicationValue::new(CommunicationType::error).with_id(cv.get_id()); + let _ = self.sender.send(&err_msg).await; + } + } + } + return; + } + if !cv.is_type(CommunicationType::identification) { return; }