| Crates.io | enigma-protocol |
| lib.rs | enigma-protocol |
| version | 0.1.0 |
| created_at | 2025-12-15 12:18:00.609448+00 |
| updated_at | 2025-12-15 12:18:00.609448+00 |
| description | High-level orchestrator that composes the Enigma crates into a production-ready messaging protocol |
| homepage | https://github.com/Gladius33/enigma-protocol |
| repository | https://github.com/Gladius33/enigma-protocol |
| max_upload_size | |
| id | 1985908 |
| size | 109,512 |
A standalone orchestrator crate that wires identity, ratchet-style key evolution, packet framing, and AEAD wrapping into a cohesive messaging stack. It focuses on producing deterministic, testable flows that applications can embed without taking a dependency on storage or UI layers.
enigma-packet and transport privacy via enigma-aeaduse std::sync::Arc;
use enigma_identity::LocalIdentity;
use enigma_protocol::{in_memory_duplex_pair, AttachmentKind, InitiatorOrResponder, MessengerClient, SessionBootstrap};
#[tokio::main]
async fn main() -> enigma_protocol::Result<()> {
let alice_identity = LocalIdentity::new("alice")?;
let bob_identity = LocalIdentity::new("bob")?;
let (transport_a, transport_b) = in_memory_duplex_pair(32);
let mut alice = MessengerClient::new(alice_identity, Arc::clone(&transport_a));
let mut bob = MessengerClient::new(bob_identity, Arc::clone(&transport_b));
let shared = [7u8; 32];
alice.ensure_session_with(
"bob",
SessionBootstrap::PreSharedSecret {
secret32: shared,
role: InitiatorOrResponder::Initiator,
remote_dh_pub: None,
},
)?;
bob.ensure_session_with(
"alice",
SessionBootstrap::PreSharedSecret {
secret32: shared,
role: InitiatorOrResponder::Responder,
remote_dh_pub: None,
},
)?;
alice.send_text("bob", "hello world").await?;
if let Some(event) = bob.poll_once().await? {
println!("received: {:?}", event);
}
let bytes = vec![0u8; 4096];
alice
.send_attachment_bytes(
"bob",
AttachmentKind::File,
Some("blob.bin"),
Some("application/octet-stream"),
&bytes,
1024,
)
.await?;
Ok(())
}
| Concern | Crate |
|---|---|
| Local identity, bundles | enigma-identity |
| Ratchet key schedule | enigma-double-ratchet compatible adapter |
| Packet schema + validation | enigma-packet |
| AEAD and packet framing | enigma-aead |
| Optional WebRTC transport | enigma-transport-webrtc feature |
Run cargo test to execute the unit and integration suite. All tests rely solely on the in-memory duplex transport.