removed owner-signature from details response
This commit is contained in:
@@ -81,7 +81,6 @@ impl GatewayBond {
|
||||
pub struct GatewayNodeDetailsResponse {
|
||||
pub identity_key: String,
|
||||
pub sphinx_key: String,
|
||||
pub owner_signature: String,
|
||||
pub announce_address: String,
|
||||
pub bind_address: String,
|
||||
pub version: String,
|
||||
@@ -94,7 +93,6 @@ impl fmt::Display for GatewayNodeDetailsResponse {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
writeln!(f, "Identity Key: {}", self.identity_key)?;
|
||||
writeln!(f, "Sphinx Key: {}", self.sphinx_key)?;
|
||||
writeln!(f, "Owner Signature: {}", self.owner_signature)?;
|
||||
writeln!(
|
||||
f,
|
||||
"Host: {} (bind address: {})",
|
||||
|
||||
@@ -167,7 +167,6 @@ impl MixNodeCostParams {
|
||||
pub struct MixnodeNodeDetailsResponse {
|
||||
pub identity_key: String,
|
||||
pub sphinx_key: String,
|
||||
pub owner_signature: String,
|
||||
pub announce_address: String,
|
||||
pub bind_address: String,
|
||||
pub version: String,
|
||||
@@ -182,7 +181,6 @@ impl fmt::Display for MixnodeNodeDetailsResponse {
|
||||
let wallet_address = self.wallet_address.clone().unwrap_or_default();
|
||||
writeln!(f, "Identity Key: {}", self.identity_key)?;
|
||||
writeln!(f, "Sphinx Key: {}", self.sphinx_key)?;
|
||||
writeln!(f, "Owner Signature: {}", self.owner_signature)?;
|
||||
writeln!(
|
||||
f,
|
||||
"Host: {} (bind address: {})",
|
||||
|
||||
@@ -291,6 +291,7 @@ impl Config {
|
||||
&self.gateway.version
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn get_wallet_address(&self) -> Option<nyxd::AccountId> {
|
||||
self.gateway.wallet_address.clone()
|
||||
}
|
||||
|
||||
+1
-22
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use self::storage::PersistentStorage;
|
||||
use crate::commands::ensure_correct_bech32_prefix;
|
||||
use crate::config::persistence::pathfinder::GatewayPathfinder;
|
||||
use crate::config::Config;
|
||||
use crate::error::GatewayError;
|
||||
@@ -12,8 +11,7 @@ use crate::node::client_handling::websocket::connection_handler::coconut::Coconu
|
||||
use crate::node::mixnet_handling::receiver::connection_handler::ConnectionHandler;
|
||||
use crate::node::statistics::collector::GatewayStatisticsCollector;
|
||||
use crate::node::storage::Storage;
|
||||
use crate::{commands::sign::load_identity_keys, OutputFormat};
|
||||
use colored::Colorize;
|
||||
use crate::OutputFormat;
|
||||
use log::*;
|
||||
use mixnet_client::forwarder::{MixForwardingSender, PacketForwarder};
|
||||
use nym_crypto::asymmetric::{encryption, identity};
|
||||
@@ -24,7 +22,6 @@ use rand::seq::SliceRandom;
|
||||
use rand::thread_rng;
|
||||
use std::error::Error;
|
||||
use std::net::SocketAddr;
|
||||
use std::process;
|
||||
use std::sync::Arc;
|
||||
use validator_client::Client;
|
||||
|
||||
@@ -109,28 +106,10 @@ where
|
||||
sphinx_keypair
|
||||
}
|
||||
|
||||
/// Signs the node config's bech32 address to produce a verification code for use in the wallet.
|
||||
/// Exits if the address isn't valid (which should protect against manual edits).
|
||||
fn generate_owner_signature(&self) -> Result<String, GatewayError> {
|
||||
let pathfinder = GatewayPathfinder::new_from_config(&self.config);
|
||||
let identity_keypair = load_identity_keys(&pathfinder);
|
||||
let Some(address) = self.config.get_wallet_address() else {
|
||||
let error_message = "Error: gateway hasn't set its wallet address".red();
|
||||
eprintln!("{error_message}");
|
||||
eprintln!("Exiting...");
|
||||
process::exit(1);
|
||||
};
|
||||
// perform extra validation to ensure we have correct prefix
|
||||
ensure_correct_bech32_prefix(&address)?;
|
||||
let verification_code = identity_keypair.private_key().sign_text(address.as_ref());
|
||||
Ok(verification_code)
|
||||
}
|
||||
|
||||
pub(crate) fn print_node_details(&self, output: OutputFormat) -> Result<(), GatewayError> {
|
||||
let node_details = nym_types::gateway::GatewayNodeDetailsResponse {
|
||||
identity_key: self.identity_keypair.public_key().to_base58_string(),
|
||||
sphinx_key: self.sphinx_keypair.public_key().to_base58_string(),
|
||||
owner_signature: self.generate_owner_signature()?,
|
||||
announce_address: self.config.get_announce_address(),
|
||||
bind_address: self.config.get_listening_address().to_string(),
|
||||
version: self.config.get_version().to_string(),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::commands::validate_bech32_address_or_exit;
|
||||
use crate::config::persistence::pathfinder::MixNodePathfinder;
|
||||
use crate::config::Config;
|
||||
use crate::node::http::{
|
||||
@@ -18,7 +17,6 @@ use crate::node::node_description::NodeDescription;
|
||||
use crate::node::node_statistics::SharedNodeStats;
|
||||
use crate::node::packet_delayforwarder::{DelayForwarder, PacketDelayForwardSender};
|
||||
use crate::OutputFormat;
|
||||
use colored::Colorize;
|
||||
use log::{error, info, warn};
|
||||
use mixnode_common::verloc::{self, AtomicVerlocResult, VerlocMeasurer};
|
||||
use nym_bin_common::version_checker::parse_version;
|
||||
@@ -84,29 +82,11 @@ impl MixNode {
|
||||
sphinx_keypair
|
||||
}
|
||||
|
||||
/// Signs the node config's bech32 address to produce a verification code for use in the wallet.
|
||||
/// 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 = Self::load_identity_keys(&pathfinder);
|
||||
let Some(address) = self.config.get_wallet_address() else {
|
||||
let error_message = "Error: mixnode hasn't set its wallet address".red();
|
||||
println!("{error_message}");
|
||||
println!("Exiting...");
|
||||
process::exit(1);
|
||||
};
|
||||
// perform extra validation to ensure we have correct prefix
|
||||
validate_bech32_address_or_exit(address.as_ref());
|
||||
let verification_code = identity_keypair.private_key().sign_text(address.as_ref());
|
||||
verification_code
|
||||
}
|
||||
|
||||
/// Prints relevant node details to the console
|
||||
pub(crate) fn print_node_details(&self, output: OutputFormat) {
|
||||
let node_details = nym_types::mixnode::MixnodeNodeDetailsResponse {
|
||||
identity_key: self.identity_keypair.public_key().to_base58_string(),
|
||||
sphinx_key: self.sphinx_keypair.public_key().to_base58_string(),
|
||||
owner_signature: self.generate_owner_signature(),
|
||||
announce_address: self.config.get_announce_address(),
|
||||
bind_address: self.config.get_listening_address().to_string(),
|
||||
version: self.config.get_version().to_string(),
|
||||
|
||||
Reference in New Issue
Block a user