add replay tag for sphinx

This commit is contained in:
Simon Wicky
2024-02-14 14:32:13 +01:00
parent a40cd73dec
commit b2c545770b
3 changed files with 14 additions and 2 deletions
+2 -1
View File
@@ -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"]
+10
View File
@@ -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)]
+2 -1
View File
@@ -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"