citadel_user/lib.rs
1//! # Citadel User Management System
2//!
3//! A comprehensive user and account management system for the Citadel Protocol, handling both
4//! network nodes and client accounts within the VPN architecture. This crate provides
5//! the foundational user management layer for the entire Citadel Protocol ecosystem.
6//!
7//! ## Features
8//!
9//! * **Account System**:
10//! - Network Accounts: Core network identity
11//! - Client Accounts: Per-connection user accounts
12//!
13//! * **Backend Support**:
14//! - File System Storage: Persistent local storage
15//! - Redis Database: High-performance caching
16//! - SQL Database: Relational data storage
17//! - In-Memory Storage: Fast temporary storage
18//!
19//! * **Authentication**:
20//! - Secure Credential Management: Password and key handling
21//! - Google Authentication: OAuth and service account support
22//! - Custom Authentication: Extensible provider system
23//!
24//! * **External Services**:
25//! - Google Services: Cloud service integration
26//! - Firebase RTDB: Real-time data synchronization
27//! - Service Interface: Common communication layer
28//!
29//! * **Account Management**:
30//! - Account Creation: Secure account initialization
31//! - Credential Updates: Safe password and key rotation
32//! - State Management: Account lifecycle handling
33//! - Account Recovery: Backup and restore features
34//!
35//! ## Architecture
36//!
37//! The system is built on a network-client account structure:
38//!
39//! ```text
40//! Network Account (NAC)
41//! └── Client Account (CNAC)
42//! ├── Connection Metadata
43//! ├── Credentials
44//! └── External Services
45//! ```
46//!
47//! ## Security Features
48//!
49//! * Zero-trust architecture
50//! * Post-quantum cryptography support
51//! * Secure credential storage
52//! * Safe account recovery
53//! * Encrypted data transmission
54//!
55//! ## Important Notes
56//!
57//! * Multiple ClientAccounts can exist per node
58//! * All operations are safe and secure by default
59//! * File system operations are feature-gated, enabled by default
60//! * External services require appropriate feature flags
61//!
62//! ## Related Components
63//!
64//! * [`citadel_crypt`]: Cryptographic operations
65//! * [`citadel_wire`]: Network communication
66//! * [`citadel_types`]: Common type definitions
67//! * [`citadel_pqcrypto`]: Post-quantum cryptography
68//!
69//! ## Feature Flags
70//!
71//! * `filesystem`: Enable file system storage
72//! * `google-services`: Enable Google service integration
73//! * `redis`: Enable Redis database support
74//! * `sql`: Enable SQL database support
75//!
76#![forbid(unsafe_code)]
77#![deny(
78 trivial_numeric_casts,
79 unused_extern_crates,
80 unused_import_braces,
81 variant_size_differences,
82 unused_features,
83 unused_results
84)]
85#![allow(rustdoc::broken_intra_doc_links)]
86
87/// Standard imports for this library
88pub mod prelude {
89 pub use crate::client_account::*;
90 pub use crate::connection_metadata::*;
91 pub use crate::hypernode_account::*;
92 pub use citadel_crypt::scramble::streaming_crypt_scrambler::MAX_BYTES_PER_GROUP;
93}
94
95/// Serde and others
96pub mod re_exports {
97 #[cfg(all(feature = "filesystem", not(target_family = "wasm")))]
98 pub use crate::directory_store::DirectoryStore;
99 #[cfg(feature = "google-services")]
100 pub use firebase_rtdb::FirebaseRTDB;
101 pub use serde::*;
102}
103
104/// The general trait for creating account types
105pub mod hypernode_account;
106
107/// Each node must necessarily have a NetworkAccount that is invariant to any ClientAccounts.
108/// See the description for [client_account] below for more information.
109pub mod connection_metadata;
110
111/// Each client within a VPN has a unique ClientAccount. Multiple CAC's are possible per node.
112///
113/// Structural design notes: In production mode, it is necessary that a [ClientNetworkAccount] be
114/// created by virtue of the subroutines within the [NetworkAccount]. In other words, a NAC is not
115/// only needed, but also the means for creating a CNAC. NAC -> CNAC. It terms of abstraction, we
116/// now ascend a level: Let the node at any point along the network, independent of central server,
117/// be called a NAC. A NAC is necessary to connect and create mutually-trusted connections within
118/// the WAN (Wide-area network).
119///
120/// evoc_null(web 3.0) => void && let void alloc finite && set network evoc_null(!VPN)
121pub mod client_account;
122
123#[cfg(feature = "filesystem")]
124/// This provides methods to load all locally-stored files
125pub mod account_loader;
126/// The server in legacy_citadel_proto requires a means of handling the user database. This module contains the means of achieving this
127pub mod account_manager;
128/// For authentication
129pub mod auth;
130/// For handling different I/O operations
131pub mod backend;
132pub mod credentials;
133#[cfg(feature = "filesystem")]
134/// Environmental constants and subroutines for pre-checking the system
135pub mod directory_store;
136/// For services
137pub mod external_services;
138/// For errors
139pub mod misc;
140/// Contains basic subroutines for serialization
141pub mod serialization;
142pub mod server_misc_settings;