fedimint_core/
setup_code.rs

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