From b2c545770bb5f5e3d2ccf9cfac5ae34f24e816e5 Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Wed, 14 Feb 2024 14:32:13 +0100 Subject: [PATCH] add replay tag for sphinx --- common/nymsphinx/types/Cargo.toml | 3 ++- common/nymsphinx/types/src/lib.rs | 10 ++++++++++ nym-outfox/Cargo.toml | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/nymsphinx/types/Cargo.toml b/common/nymsphinx/types/Cargo.toml index 47ad47c2d2..e31ea123f1 100644 --- a/common/nymsphinx/types/Cargo.toml +++ b/common/nymsphinx/types/Cargo.toml @@ -8,9 +8,10 @@ license = { workspace = true } repository = { workspace = true } [dependencies] -sphinx-packet = { version = "0.1.0", optional = true } +#sphinx-packet = { version = "0.1.0", optional = true } nym-outfox = { path = "../../../nym-outfox", optional = true } thiserror = { workspace = true } +sphinx-packet = { git = "https://github.com/nymtech/sphinx.git", branch = "simon/replay_tag", optional = true} [features] default = ["sphinx"] diff --git a/common/nymsphinx/types/src/lib.rs b/common/nymsphinx/types/src/lib.rs index d75060e9b0..8f64868c95 100644 --- a/common/nymsphinx/types/src/lib.rs +++ b/common/nymsphinx/types/src/lib.rs @@ -9,6 +9,7 @@ pub use nym_outfox::{ // re-exporting types and constants available in sphinx #[cfg(feature = "outfox")] use nym_outfox::packet::{OutfoxPacket, OutfoxProcessedPacket}; +use sphinx_packet::header::keys::ReplayTag; #[cfg(feature = "sphinx")] pub use sphinx_packet::{ constants::{ @@ -57,6 +58,15 @@ pub enum NymProcessedPacket { Outfox(OutfoxProcessedPacket), } +impl NymProcessedPacket { + pub fn replay_tag(&self) -> ReplayTag { + match self { + NymProcessedPacket::Sphinx(sphinx) => sphinx.replay_tag(), + NymProcessedPacket::Outfox(_) => todo!(), //SW temporary while I add a replay tag to outfox + } + } +} + impl fmt::Debug for NymPacket { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { #[allow(unreachable_patterns)] diff --git a/nym-outfox/Cargo.toml b/nym-outfox/Cargo.toml index bfcd49c233..b662951a32 100644 --- a/nym-outfox/Cargo.toml +++ b/nym-outfox/Cargo.toml @@ -18,7 +18,8 @@ curve25519-dalek = "3.2" chacha20poly1305 = "0.10.1" getrandom = { workspace = true, features = ["js"] } thiserror = { workspace = true } -sphinx-packet = "0.1.0" +#sphinx-packet = "0.1.0" +sphinx-packet = { git = "https://github.com/nymtech/sphinx.git", branch = "simon/replay_tag"} rand = "0.7.3" log = "0.4"