fedimint_unknown_common/
config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use fedimint_core::core::ModuleKind;
use fedimint_core::encoding::{Decodable, Encodable};
use fedimint_core::plugin_types_trait_impl_config;
use serde::{Deserialize, Serialize};

use crate::UnknownCommonInit;

/// Parameters necessary to generate this module's configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UnknownGenParams {
    pub local: UnknownGenParamsLocal,
    pub consensus: UnknownGenParamsConsensus,
}

/// Local parameters for config generation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UnknownGenParamsLocal;

/// Consensus parameters for config generation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UnknownGenParamsConsensus;

impl Default for UnknownGenParams {
    fn default() -> Self {
        Self {
            local: UnknownGenParamsLocal,
            consensus: UnknownGenParamsConsensus,
        }
    }
}

/// Contains all the configuration for the server
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UnknownConfig {
    pub local: UnknownConfigLocal,
    pub private: UnknownConfigPrivate,
    pub consensus: UnknownConfigConsensus,
}

/// Contains all the configuration for the client
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Encodable, Decodable, Hash)]
pub struct UnknownClientConfig;

/// Locally unencrypted config unique to each member
#[derive(Clone, Debug, Serialize, Deserialize, Decodable, Encodable)]
pub struct UnknownConfigLocal;

/// Will be the same for every federation member
#[derive(Clone, Debug, Serialize, Deserialize, Decodable, Encodable)]
pub struct UnknownConfigConsensus;

/// Will be encrypted and not shared such as private key material
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UnknownConfigPrivate;

// Wire together the configs for this module
plugin_types_trait_impl_config!(
    UnknownCommonInit,
    UnknownGenParams,
    UnknownGenParamsLocal,
    UnknownGenParamsConsensus,
    UnknownConfig,
    UnknownConfigLocal,
    UnknownConfigPrivate,
    UnknownConfigConsensus,
    UnknownClientConfig
);