nym_registration_common/
lib.rs

1// Copyright 2025 - Nym Technologies SA <contact@nymtech.net>
2// SPDX-License-Identifier: Apache-2.0
3
4use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
5
6use nym_authenticator_requests::AuthenticatorVersion;
7use nym_crypto::asymmetric::x25519::{PublicKey, serde_helpers::bs58_x25519_pubkey};
8use nym_ip_packet_requests::IpPair;
9use nym_sphinx::addressing::{NodeIdentity, Recipient};
10use serde::{Deserialize, Serialize};
11
12mod lp_messages;
13mod serialisation;
14
15pub use lp_messages::{
16    LpGatewayData, LpRegistrationRequest, LpRegistrationResponse, RegistrationMode,
17};
18pub use serialisation::BincodeError;
19
20#[derive(Debug, Clone, Copy, PartialEq)]
21pub struct NymNode {
22    pub identity: NodeIdentity,
23    pub ip_address: IpAddr,
24    pub ipr_address: Option<Recipient>,
25    pub authenticator_address: Option<Recipient>,
26    pub lp_address: Option<SocketAddr>,
27    pub version: AuthenticatorVersion,
28}
29#[derive(Clone, Debug, Serialize, Deserialize)]
30pub struct GatewayData {
31    #[serde(with = "bs58_x25519_pubkey")]
32    pub public_key: PublicKey,
33    pub endpoint: SocketAddr,
34    pub private_ipv4: Ipv4Addr,
35    pub private_ipv6: Ipv6Addr,
36}
37
38#[derive(Clone, Copy, Debug)]
39pub struct AssignedAddresses {
40    pub entry_mixnet_gateway_ip: IpAddr,
41    pub exit_mixnet_gateway_ip: IpAddr,
42    pub mixnet_client_address: Recipient,
43    pub exit_mix_address: Recipient,
44    pub interface_addresses: IpPair,
45}