diff --git a/sphinx-key/Cargo.lock b/sphinx-key/Cargo.lock index 9822b7c..2830a7c 100644 --- a/sphinx-key/Cargo.lock +++ b/sphinx-key/Cargo.lock @@ -181,7 +181,6 @@ checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3" dependencies = [ "bech32", "bitcoin_hashes", - "bitcoinconsensus", "secp256k1", "serde", ] @@ -195,16 +194,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bitcoinconsensus" -version = "0.20.2-0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54505558b77e0aa21b2491a7b39cbae9db22ac8b1bc543ef4600edb762306f9c" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -1271,8 +1260,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e009e1c0c21f66378b491bb40f548682138c63e09db6f3a05af59f8804bb9f4a" dependencies = [ "bitcoin", - "hex", - "regex", ] [[package]] @@ -1326,7 +1313,7 @@ dependencies = [ [[package]] name = "lss-connector" version = "0.1.0" -source = "git+https://github.com/stakwork/sphinx-rs.git#e128e6cc4a7d8b2ac8bab60f7d5c76adfd6d2db1" +source = "git+https://github.com/stakwork/sphinx-rs.git#2a90ef961230299510d1f5e0bd70812523ce7ce3" dependencies = [ "anyhow", "log", @@ -1978,7 +1965,7 @@ dependencies = [ [[package]] name = "sphinx-auther" version = "0.1.12" -source = "git+https://github.com/stakwork/sphinx-rs.git#e128e6cc4a7d8b2ac8bab60f7d5c76adfd6d2db1" +source = "git+https://github.com/stakwork/sphinx-rs.git#2a90ef961230299510d1f5e0bd70812523ce7ce3" dependencies = [ "anyhow", "base64", @@ -1990,7 +1977,7 @@ dependencies = [ [[package]] name = "sphinx-crypter" version = "0.1.0" -source = "git+https://github.com/stakwork/sphinx-rs.git#e128e6cc4a7d8b2ac8bab60f7d5c76adfd6d2db1" +source = "git+https://github.com/stakwork/sphinx-rs.git#2a90ef961230299510d1f5e0bd70812523ce7ce3" dependencies = [ "anyhow", "chacha20poly1305", @@ -2001,7 +1988,7 @@ dependencies = [ [[package]] name = "sphinx-glyph" version = "0.1.2" -source = "git+https://github.com/stakwork/sphinx-rs.git#e128e6cc4a7d8b2ac8bab60f7d5c76adfd6d2db1" +source = "git+https://github.com/stakwork/sphinx-rs.git#2a90ef961230299510d1f5e0bd70812523ce7ce3" dependencies = [ "anyhow", "hex", @@ -2038,7 +2025,7 @@ dependencies = [ [[package]] name = "sphinx-signer" version = "0.1.0" -source = "git+https://github.com/stakwork/sphinx-rs.git#e128e6cc4a7d8b2ac8bab60f7d5c76adfd6d2db1" +source = "git+https://github.com/stakwork/sphinx-rs.git#2a90ef961230299510d1f5e0bd70812523ce7ce3" dependencies = [ "anyhow", "bip39", @@ -2401,7 +2388,6 @@ version = "0.9.0" source = "git+https://gitlab.com/lightning-signer/validating-lightning-signer.git?rev=0c8c4474af62c4a13e2a32d34b569e8092ed414a#0c8c4474af62c4a13e2a32d34b569e8092ed414a" dependencies = [ "anyhow", - "backtrace", "bitcoin", "bolt-derive", "hashbrown 0.8.2", diff --git a/sphinx-key/src/core/events.rs b/sphinx-key/src/core/events.rs index 21e99a1..fbc9a12 100644 --- a/sphinx-key/src/core/events.rs +++ b/sphinx-key/src/core/events.rs @@ -104,7 +104,6 @@ pub fn make_event_loop( Err(e) => { log::error!("failed to init lss {:?}", e); unsafe { esp_idf_sys::esp_restart() }; - panic!("faild to init lss"); } }; @@ -147,7 +146,20 @@ pub fn make_event_loop( }; } Event::LssMessage(ref msg_bytes) => { - // + // FIXME: the "None" needs to previous VLS message and LSS message bytes + match lss::handle_lss_msg(msg_bytes, &None, &lss_signer) { + Ok((ret_topic, bytes)) => { + let return_topic = format!("{}/{}", client_id, &ret_topic); + mqtt.publish(&return_topic, QOS, false, &bytes) + .expect("could not publish response"); + } + Err(e) => { + let err_msg = GlyphError::new(1, &e.to_string()); + let error_topic = format!("{}/{}", client_id, topics::ERROR); + mqtt.publish(&error_topic, QOS, false, &err_msg.to_vec()[..]) + .expect("could not publish error"); + } + } } Event::Control(ref msg_bytes) => { log::info!("GOT A CONTROL MSG"); diff --git a/sphinx-key/src/core/lss.rs b/sphinx-key/src/core/lss.rs index 7123589..252a597 100644 --- a/sphinx-key/src/core/lss.rs +++ b/sphinx-key/src/core/lss.rs @@ -5,11 +5,13 @@ use embedded_svc::mqtt::client::MessageImpl; use embedded_svc::utils::mqtt::client::ConnState; use esp_idf_svc::mqtt::client::EspMqttClient; use esp_idf_sys::EspError; -use lss_connector::{secp256k1::PublicKey, LssSigner, Msg as LssMsg, Response as LssRes}; +use lss_connector::{secp256k1::PublicKey, LssSigner, Msg as LssMsg}; use sphinx_signer::sphinx_glyph::topics; use sphinx_signer::{self, RootHandler, RootHandlerBuilder}; use std::sync::mpsc; +pub use lss_connector::handle_lss_msg; + pub fn init_lss( client_id: &str, rx: &mpsc::Receiver,