Tidy nym-mixnode module visibility (#1075)

* mixnode: make command modules private

* mixnode: make some node modules private

* mixnode: make config structs private

* mixnode: restore accidentally moved function
This commit is contained in:
Jon Häggblad
2022-01-27 15:03:58 +01:00
committed by GitHub
parent 1703a0a6f5
commit ff1d92b576
10 changed files with 47 additions and 48 deletions
+5 -6
View File
@@ -1,7 +1,6 @@
// Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::commands::sign::load_identity_keys;
use crate::commands::validate_bech32_address_or_exit;
use crate::config::persistence::pathfinder::MixNodePathfinder;
use crate::config::Config;
@@ -28,11 +27,11 @@ use std::process;
use std::sync::Arc;
use version_checker::parse_version;
pub(crate) mod http;
mod http;
mod listener;
pub(crate) mod node_description;
pub(crate) mod node_statistics;
pub(crate) mod packet_delayforwarder;
mod node_statistics;
mod packet_delayforwarder;
// the MixNode will live for whole duration of this program
pub struct MixNode {
@@ -60,7 +59,7 @@ impl MixNode {
}
/// Loads identity keys stored on disk
fn load_identity_keys(pathfinder: &MixNodePathfinder) -> identity::KeyPair {
pub(crate) fn load_identity_keys(pathfinder: &MixNodePathfinder) -> identity::KeyPair {
let identity_keypair: identity::KeyPair =
pemstore::load_keypair(&pemstore::KeyPairPath::new(
pathfinder.private_identity_key().to_owned(),
@@ -85,7 +84,7 @@ impl MixNode {
/// Exits if the address isn't valid (which should protect against manual edits).
fn generate_owner_signature(&self) -> String {
let pathfinder = MixNodePathfinder::new_from_config(&self.config);
let identity_keypair = load_identity_keys(&pathfinder);
let identity_keypair = Self::load_identity_keys(&pathfinder);
let address = self.config.get_wallet_address();
validate_bech32_address_or_exit(address);
let verification_code = identity_keypair.private_key().sign_text(address);