swap id key for sphinx key

This commit is contained in:
Simon Wicky
2023-07-24 16:54:08 +02:00
parent eca406d9a7
commit dc77e3f962
5 changed files with 19 additions and 24 deletions
+7 -4
View File
@@ -3,7 +3,7 @@
use crate::filter::VersionFilterable;
use log::warn;
use nym_crypto::asymmetric::identity;
use nym_crypto::asymmetric::encryption;
use nym_mixnet_contract_common::mixnode::MixNodeDetails;
use nym_mixnet_contract_common::{GatewayBond, IdentityKeyRef, MixId};
use nym_sphinx_addressing::nodes::NodeIdentity;
@@ -108,16 +108,19 @@ impl NymTopology {
None
}
pub fn find_node_key_by_mix_host(&self, mix_host: SocketAddr) -> Option<&identity::PublicKey> {
pub fn find_node_key_by_mix_host(
&self,
mix_host: SocketAddr,
) -> Option<&encryption::PublicKey> {
for node in self.gateways.iter() {
if node.mix_host.ip() == mix_host.ip() {
return Some(&node.identity_key);
return Some(&node.sphinx_key);
}
}
for nodes in self.mixes.values() {
for node in nodes {
if node.mix_host.ip() == mix_host.ip() {
return Some(&node.identity_key);
return Some(&node.sphinx_key);
}
}
}
@@ -3,14 +3,14 @@
use crate::node::client_handling::active_clients::ActiveClientsStore;
use crate::node::client_handling::websocket::message_receiver::MixMessageSender;
use crate::node::identity::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH};
use crate::node::encryption::{PRIVATE_KEY_SIZE, PUBLIC_KEY_SIZE};
use crate::node::mixnet_handling::receiver::packet_processing::PacketProcessor;
use crate::node::storage::error::StorageError;
use crate::node::storage::Storage;
use futures::StreamExt;
use log::*;
use nym_client_core::client::topology_control::accessor::TopologyAccessor;
use nym_crypto::asymmetric::identity;
use nym_crypto::asymmetric::encryption;
use nym_mixnet_client::forwarder::MixForwardingSender;
use nym_mixnode_common::packet_processor::processor::ProcessedFinalHop;
use nym_noise::upgrade_noise_responder;
@@ -36,8 +36,8 @@ pub(crate) struct ConnectionHandler<St: Storage> {
storage: St,
ack_sender: MixForwardingSender,
topology_access: TopologyAccessor,
public_identity_key: [u8; PUBLIC_KEY_LENGTH],
private_identity_key: [u8; SECRET_KEY_LENGTH],
public_identity_key: [u8; PUBLIC_KEY_SIZE],
private_identity_key: [u8; PRIVATE_KEY_SIZE],
}
impl<St: Storage + Clone> Clone for ConnectionHandler<St> {
@@ -70,7 +70,7 @@ impl<St: Storage> ConnectionHandler<St> {
ack_sender: MixForwardingSender,
active_clients_store: ActiveClientsStore,
topology_access: TopologyAccessor,
identity_key: &identity::KeyPair,
identity_key: &encryption::KeyPair,
) -> Self {
ConnectionHandler {
packet_processor,
+1 -1
View File
@@ -146,7 +146,7 @@ impl<St> Gateway<St> {
ack_sender,
active_clients_store,
topology_access,
&self.identity_keypair,
&self.sphinx_keypair,
);
let listening_address = SocketAddr::new(
@@ -1,7 +1,7 @@
// Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::node::identity::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH};
use crate::node::encryption::{PRIVATE_KEY_SIZE, PUBLIC_KEY_SIZE};
use crate::node::listener::connection_handler::packet_processing::{
MixProcessingResult, PacketProcessor,
};
@@ -9,7 +9,7 @@ use crate::node::packet_delayforwarder::PacketDelayForwardSender;
use crate::node::TaskClient;
use futures::StreamExt;
use nym_client_core::client::topology_control::accessor::TopologyAccessor;
use nym_crypto::asymmetric::identity;
use nym_crypto::asymmetric::encryption;
use nym_mixnode_common::measure;
use nym_noise::upgrade_noise_responder;
use nym_sphinx::forwarding::packet::MixPacket;
@@ -30,8 +30,8 @@ pub(crate) struct ConnectionHandler {
packet_processor: PacketProcessor,
delay_forwarding_channel: PacketDelayForwardSender,
topology_access: TopologyAccessor,
private_identity_key: [u8; SECRET_KEY_LENGTH],
public_identity_key: [u8; PUBLIC_KEY_LENGTH],
private_identity_key: [u8; PRIVATE_KEY_SIZE],
public_identity_key: [u8; PUBLIC_KEY_SIZE],
}
impl ConnectionHandler {
@@ -39,7 +39,7 @@ impl ConnectionHandler {
packet_processor: PacketProcessor,
delay_forwarding_channel: PacketDelayForwardSender,
topology_access: TopologyAccessor,
identity_key: &identity::KeyPair,
identity_key: &encryption::KeyPair,
) -> Self {
ConnectionHandler {
packet_processor,
+1 -9
View File
@@ -164,7 +164,7 @@ impl MixNode {
packet_processor,
delay_forwarding_channel,
topology_access,
&self.identity_keypair,
&self.sphinx_keypair,
);
let listening_address = SocketAddr::new(
@@ -325,14 +325,6 @@ impl MixNode {
if self.check_if_bonded().await {
warn!("You seem to have bonded your mixnode before starting it - that's highly unrecommended as in the future it might result in slashing");
}
println!(
"Secret key start : {:?}",
self.identity_keypair.private_key().to_bytes()
);
println!(
"Public key start : {:?}",
self.identity_keypair.public_key().to_bytes()
);
let shutdown = TaskManager::default();