From 99e2798791a76fc169a94b7ef39e95f2124d576c Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Wed, 7 Jan 2026 11:22:40 +0100 Subject: [PATCH] serialize gateway data (#6314) --- Cargo.lock | 1 + common/registration/Cargo.toml | 1 + common/registration/src/lib.rs | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56dc7371a7..937200cca4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6825,6 +6825,7 @@ dependencies = [ "nym-crypto", "nym-ip-packet-requests", "nym-sphinx", + "serde", "tokio-util", ] diff --git a/common/registration/Cargo.toml b/common/registration/Cargo.toml index 22749ccdc9..9133bad4de 100644 --- a/common/registration/Cargo.toml +++ b/common/registration/Cargo.toml @@ -13,6 +13,7 @@ workspace = true [dependencies] tokio-util.workspace = true +serde.workspace = true nym-authenticator-requests = { path = "../authenticator-requests" } nym-crypto = { path = "../crypto" } diff --git a/common/registration/src/lib.rs b/common/registration/src/lib.rs index f07ea673eb..e0812ca2c6 100644 --- a/common/registration/src/lib.rs +++ b/common/registration/src/lib.rs @@ -1,10 +1,11 @@ // Copyright 2025 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use serde::{Deserialize, Serialize}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use nym_authenticator_requests::AuthenticatorVersion; -use nym_crypto::asymmetric::x25519::PublicKey; +use nym_crypto::asymmetric::x25519::{PublicKey, serde_helpers::bs58_x25519_pubkey}; use nym_ip_packet_requests::IpPair; use nym_sphinx::addressing::{NodeIdentity, Recipient}; @@ -16,9 +17,9 @@ pub struct NymNode { pub authenticator_address: Option, pub version: AuthenticatorVersion, } - -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct GatewayData { + #[serde(with = "bs58_x25519_pubkey")] pub public_key: PublicKey, pub endpoint: SocketAddr, pub private_ipv4: Ipv4Addr,