1pub mod crypto;
15#[cfg(feature = "native-crypto")]
16pub mod transport;
17#[cfg(feature = "native-crypto")]
18pub mod protocol;
19#[cfg(feature = "native-crypto")]
20pub mod node;
21#[cfg(feature = "native-crypto")]
22pub mod ai;
23
24mod error;
25#[cfg(feature = "native-crypto")]
26mod identity;
27
28pub use error::{Error, Result};
29#[cfg(feature = "native-crypto")]
30pub use identity::{Identity, Fingerprint};
31
32pub const VERSION: &str = env!("CARGO_PKG_VERSION");
34
35pub const BITCHAT_PROTOCOL_VERSION: u8 = 1;
37
38pub const PQC_PROTOCOL_VERSION: u8 = 1;
40
41#[derive(Debug, Clone)]
43pub struct Config {
44 pub enable_pqc: bool,
46
47 pub enable_noise_fallback: bool,
49
50 pub enable_qrng: bool,
52
53 pub enable_qkd: bool,
55
56 pub enable_node: bool,
58
59 pub enable_validator: bool,
61
62 pub enable_ai_agent: bool,
64
65 pub nostr_relays: Vec<String>,
67
68 pub node_rpc: String,
70}
71
72impl Default for Config {
73 fn default() -> Self {
74 Self {
75 enable_pqc: true,
76 enable_noise_fallback: true,
77 enable_qrng: true,
78 enable_qkd: true,
79 enable_node: true,
80 enable_validator: false,
81 enable_ai_agent: false,
82 nostr_relays: vec![
83 "wss://relay.damus.io".into(),
84 "wss://nos.lol".into(),
85 "wss://relay.nostr.band".into(),
86 ],
87 node_rpc: "http://localhost:9944".into(),
88 }
89 }
90}
91
92#[cfg(feature = "native-crypto")]
94pub struct QuantumCommunicator {
95 config: Config,
96 identity: Identity,
97}
98
99#[cfg(feature = "native-crypto")]
100impl QuantumCommunicator {
101 pub fn new(config: Config) -> Result<Self> {
103 let identity = Identity::generate()?;
104 Ok(Self { config, identity })
105 }
106
107 pub fn with_identity(config: Config, identity: Identity) -> Self {
109 Self { config, identity }
110 }
111
112 pub fn identity(&self) -> &Identity {
114 &self.identity
115 }
116
117 pub fn config(&self) -> &Config {
119 &self.config
120 }
121}