| Crates.io | enigma-transport-webrtc |
| lib.rs | enigma-transport-webrtc |
| version | 0.1.1 |
| created_at | 2025-12-15 11:47:57.654325+00 |
| updated_at | 2025-12-15 13:51:15.892766+00 |
| description | WebRTC transport bindings for Enigma secure messaging sessions |
| homepage | https://github.com/Gladius33/enigma-transport-webrtc |
| repository | https://github.com/Gladius33/enigma-transport-webrtc |
| max_upload_size | |
| id | 1985886 |
| size | 101,558 |
A byte-level transport crate that wraps a single WebRTC DataChannel and exposes a deterministic mock for testing. The scope is limited to creating offers/answers, sharing ICE candidates, and moving opaque bytes; signaling, encryption, and higher-level framing stay with the embedding application.
&[u8] payloads over a single binary data channel.create_offer() on the initiator.accept_offer().accept_answer() on the initiator.LocalIceCandidate events emitted through next_event() back to the peer via add_ice_candidate().next_event() also emits Connected, and the connected transports can start calling send()/recv().use enigma_transport_webrtc::{MockTransport, ByteTransport};
#[tokio::main]
async fn main() {
let (mut alice, mut bob) = MockTransport::pair(16);
let offer = alice.create_offer().await.unwrap();
let answer = bob.accept_offer(&offer).await.unwrap();
alice.accept_answer(&answer).await.unwrap();
alice.send(b"ping").await.unwrap();
let pong = bob.recv().await.unwrap();
assert_eq!(pong, b"ping");
}
next_event() for TransportEvent::LocalIceCandidate and send those JSON blobs over your signaling channel.TransportEvent::StateChanged tracks the internal state machine (Idle, CreatingOffer, WaitingAnswer, IncomingOffer, Connecting, Connected, Closed).Connected fires once the data channel is open, and Closed occurs when the transport shuts down.MockTransport, which mirrors the WebRTC state machine, emits the same events, and enforces the configured max_message_size.cargo test fast, deterministic, and offline-friendly.docs/api.md: ByteTransport contract, builders, and error semantics.docs/design.md: State machine and event rationale.docs/testing.md: Why the mock transport is the only test dependency.Run cargo test locally to validate the mock layer and abstraction.