From 28908ea5d862578b47c51609c0f81d1d533f4497 Mon Sep 17 00:00:00 2001 From: wiesche <120273695+wiesche89@users.noreply.github.com> Date: Tue, 28 Jul 2026 00:00:31 +0200 Subject: [PATCH] expose mwixnet onion apis (#781) --- libwallet/Cargo.toml | 3 +++ libwallet/src/mwixnet/mod.rs | 2 +- libwallet/src/mwixnet/onion/crypto/dalek.rs | 4 ---- libwallet/src/mwixnet/onion/crypto/secp.rs | 4 +--- libwallet/src/mwixnet/onion/mod.rs | 6 +++--- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 421bd97..e3a20d9 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -9,6 +9,9 @@ keywords = [ "crypto", "grin", "mimblewimble" ] exclude = ["**/*.grin", "**/*.grin2"] edition = "2021" +[features] +mwixnet-test = [] + [dependencies] blake2-rfc = "0.2" rand = "0.6" diff --git a/libwallet/src/mwixnet/mod.rs b/libwallet/src/mwixnet/mod.rs index 0605265..ebc5a9c 100644 --- a/libwallet/src/mwixnet/mod.rs +++ b/libwallet/src/mwixnet/mod.rs @@ -13,7 +13,7 @@ // limitations under the License. //! Onion modules for mxmixnet -mod onion; +pub mod onion; mod types; pub use onion::{ diff --git a/libwallet/src/mwixnet/onion/crypto/dalek.rs b/libwallet/src/mwixnet/onion/crypto/dalek.rs index 62084dd..adbebd7 100644 --- a/libwallet/src/mwixnet/onion/crypto/dalek.rs +++ b/libwallet/src/mwixnet/onion/crypto/dalek.rs @@ -69,7 +69,6 @@ impl AsRef for DalekPublicKey { } } -#[cfg(test)] /// Serializes an Option to and from hex pub mod option_dalek_pubkey_serde { use super::DalekPublicKey; @@ -152,7 +151,6 @@ impl AsRef for DalekSignature { } /// Serializes a DalekSignature to and from hex -#[cfg(test)] pub mod dalek_sig_serde { use super::DalekSignature; use grin_util::ToHex; @@ -179,8 +177,6 @@ pub mod dalek_sig_serde { } /// Dalek signature sign wrapper -// TODO: This is likely duplicated throughout crate, check -#[cfg(test)] pub fn sign(sk: &SecretKey, message: &[u8]) -> Result { use ed25519_dalek::{Signer, SigningKey}; let secret = SigningKey::from_bytes(&sk.0); diff --git a/libwallet/src/mwixnet/onion/crypto/secp.rs b/libwallet/src/mwixnet/onion/crypto/secp.rs index eda6abe..200c24f 100644 --- a/libwallet/src/mwixnet/onion/crypto/secp.rs +++ b/libwallet/src/mwixnet/onion/crypto/secp.rs @@ -18,7 +18,7 @@ pub use grin_util::secp::{ self as secp256k1zkp, constants::SECRET_KEY_SIZE, key::{SecretKey, ZERO_KEY}, - pedersen::Commitment, + pedersen::{Commitment, RangeProof}, rand::thread_rng, ContextFlag, Secp256k1, }; @@ -47,7 +47,6 @@ pub fn read_secret_key(reader: &mut R) -> Result Result { let secp = Secp256k1::with_caps(ContextFlag::Commit); let commit = secp.commit(value, blind.clone())?; @@ -76,7 +75,6 @@ pub fn sub_value(commitment: &Commitment, value: u64) -> Result