// Copyright 2025 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 use nym_authenticator_requests::AuthenticatorVersion; use nym_crypto::asymmetric::x25519::serde_helpers::bs58_x25519_pubkey; use nym_crypto::asymmetric::{ed25519, x25519}; use nym_ip_packet_requests::IpPair; use nym_kkt_ciphersuite::{KEM, KEMKeyDigests, SignatureScheme}; use nym_sphinx::addressing::Recipient; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; pub use lp_messages::*; pub use serialisation::BincodeError; mod lp_messages; mod serialisation; #[derive(Debug, Clone)] pub struct NymNodeInformation { pub identity: ed25519::PublicKey, pub ip_address: IpAddr, pub ipr_address: Option, pub authenticator_address: Option, pub lp_data: Option, pub version: AuthenticatorVersion, } #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] pub struct WireguardRegistrationData { /// Public x25519 key of this gateway #[serde(with = "bs58_x25519_pubkey")] pub public_key: x25519::PublicKey, /// Port at which this gateway is accessible for wireguard pub port: u16, /// Ipv4 address assigned to this peer pub private_ipv4: Ipv4Addr, /// Ipv6 address assigned to this peer pub private_ipv6: Ipv6Addr, } #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] pub struct WireguardConfiguration { #[serde(with = "bs58_x25519_pubkey")] pub public_key: x25519::PublicKey, pub psk: Option<[u8; 32]>, pub endpoint: SocketAddr, pub private_ipv4: Ipv4Addr, pub private_ipv6: Ipv6Addr, } #[derive(Clone, Debug)] pub struct NymNodeLPInformation { pub address: SocketAddr, pub expected_kem_key_hashes: HashMap, pub expected_signing_key_hashes: HashMap, pub x25519: x25519::PublicKey, /// Supported protocol version of the remote gateway. /// Included in case we have to downgrade our version. pub lp_protocol_version: u8, } #[derive(Clone, Copy, Debug)] pub struct AssignedAddresses { pub entry_mixnet_gateway_ip: IpAddr, pub exit_mixnet_gateway_ip: IpAddr, pub mixnet_client_address: Recipient, pub exit_mix_address: Recipient, pub interface_addresses: IpPair, }