fedimint_core/
setup_code.rs

1use serde::Serialize;
2
3use crate::encoding::{Decodable, Encodable};
4use crate::util::SafeUrl;
5
6#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Serialize)]
7/// Connection information sent between peers in order to start config gen
8pub struct PeerSetupCode {
9    /// Name of the peer, used in TLS auth
10    pub name: String,
11    /// The peer's api and p2p endpoint
12    pub endpoints: PeerEndpoints,
13    /// Federation name set by the leader
14    pub federation_name: Option<String>,
15    /// Whether to disable base fees, set by the leader
16    pub disable_base_fees: Option<bool>,
17}
18
19#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Serialize)]
20pub enum PeerEndpoints {
21    Tcp {
22        /// Url for our websocket api endpoint
23        api_url: SafeUrl,
24        /// Url for our websocket p2p endpoint
25        p2p_url: SafeUrl,
26        /// TLS certificate for our websocket p2p endpoint#
27        #[serde(with = "::fedimint_core::encoding::as_hex")]
28        cert: Vec<u8>,
29    },
30    Iroh {
31        /// Public key for our iroh api endpoint
32        api_pk: iroh_base::PublicKey,
33        /// Public key for our iroh p2p endpoint
34        p2p_pk: iroh_base::PublicKey,
35    },
36}