Skip to content

Commit

Permalink
Rollback useless changes
Browse files Browse the repository at this point in the history
  • Loading branch information
durch committed Jun 10, 2024
1 parent a12d28b commit 129077b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 29 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions common/nymsphinx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ log = { workspace = true }
rand = { workspace = true }
rand_distr = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true, features = ["derive"] }
bincode = { workspace = true }

nym-sphinx-acknowledgements = { path = "acknowledgements" }
nym-sphinx-addressing = { path = "addressing" }
Expand Down
3 changes: 1 addition & 2 deletions common/nymsphinx/anonymous-replies/src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use crate::{ReplySurb, ReplySurbError};
use nym_sphinx_addressing::clients::{Recipient, RecipientFormattingError};
use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
use std::mem;
use thiserror::Error;
Expand All @@ -25,7 +24,7 @@ pub enum InvalidAnonymousSenderTagRepresentation {
InvalidLength { received: usize, expected: usize },
}

#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen)]
pub struct AnonymousSenderTag([u8; SENDER_TAG_SIZE]);

Expand Down
24 changes: 1 addition & 23 deletions common/nymsphinx/src/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

use crate::message::{NymMessage, NymMessageError, PaddedMessage, PlainMessage};
use log::warn;
use nym_crypto::aes::cipher::{KeyIvInit, StreamCipher};
use nym_crypto::asymmetric::encryption;
use nym_crypto::shared_key::recompute_shared_key;
Expand All @@ -17,11 +16,10 @@ use nym_sphinx_params::{
PacketEncryptionAlgorithm, PacketHkdfAlgorithm, ReplySurbEncryptionAlgorithm,
DEFAULT_NUM_MIX_HOPS,
};
use serde::{Deserialize, Serialize};
use thiserror::Error;

// TODO: should this live in this file?
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug)]
pub struct ReconstructedMessage {
/// The actual plaintext message that was received.
pub message: Vec<u8>,
Expand All @@ -31,26 +29,6 @@ pub struct ReconstructedMessage {
pub sender_tag: Option<AnonymousSenderTag>,
}

impl From<&ReconstructedMessage> for Vec<u8> {
fn from(msg: &ReconstructedMessage) -> Vec<u8> {
match bincode::serialize(msg) {
Ok(serialized) => serialized,
Err(err) => {
warn!("failed to serialize reconstructed message - {:?}", err);
Vec::new()
}
}
}
}

impl TryFrom<&[u8]> for ReconstructedMessage {
type Error = bincode::Error;

fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
bincode::deserialize(value)
}
}

impl From<ReconstructedMessage> for (Vec<u8>, Option<AnonymousSenderTag>) {
fn from(msg: ReconstructedMessage) -> Self {
(msg.message, msg.sender_tag)
Expand Down

0 comments on commit 129077b

Please sign in to comment.