#![warn(missing_docs, rustdoc::missing_crate_level_docs)]
#![deny(unsafe_code)]
pub mod identity;
pub mod group;
pub mod message;
pub mod crypto;
pub mod error;
pub mod protocol;
pub mod key_manager;
#[cfg(feature = "async")]
pub mod async_group;
pub use identity::{Identity, PublicKey, PrivateKey};
pub use group::{PhalanxGroup, GroupConfig, MembershipProof};
pub use message::{GroupMessage, MessageContent, MessageType, EncryptedMessage};
pub use error::{PhalanxError, Result};
pub use protocol::{ProtocolVersion, HandshakeMessage, KeyRotationMessage};
pub use key_manager::{AdvancedKeyManager, KeyBackupStorage, HsmProvider};
#[cfg(feature = "async")]
pub use async_group::AsyncPhalanxGroup;
pub mod constants {
pub const MAX_GROUP_SIZE: usize = 1000;
pub const DEFAULT_KEY_ROTATION_INTERVAL: u64 = 24 * 60 * 60;
pub const MAX_MESSAGE_SIZE: usize = 1024 * 1024;
pub const PROTOCOL_VERSION: u8 = 1;
pub const MIN_PROTOCOL_VERSION: u8 = 1;
}
pub mod algorithms {
pub const AEAD: &str = "ChaCha20-Poly1305";
pub const KEY_EXCHANGE: &str = "X25519";
pub const SIGNATURE: &str = "Ed25519";
pub const HASH_KDF: &str = "BLAKE3";
pub const KEY_SIZE: usize = 32;
pub const NONCE_SIZE: usize = 12;
pub const TAG_SIZE: usize = 16;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic_encryption_flow() {
let identity = Identity::generate();
let mut group = PhalanxGroup::new(identity);
let content = MessageContent::text("Test message");
let encrypted = group.encrypt_message(&content).unwrap();
let decrypted = group.decrypt_message(&encrypted).unwrap();
assert_eq!(decrypted, content);
}
}