Skip to main content

huddle_protocol/
lib.rs

1//! # huddle-protocol
2//!
3//! The Huddle wire protocol and the pure cryptographic constructions it rests
4//! on, extracted into one runtime-free crate so both the client
5//! (`huddle-core`) and the relay (`huddle-server`) speak from a single source
6//! of truth — "the spec, as code."
7//!
8//! This crate depends ONLY on RustCrypto-family + serde crates: no `tokio`,
9//! `libp2p`, `rusqlite`, or `vodozemac`. Anything needing a runtime — the
10//! Megolm group ratchet with its SQLCipher persistence, the libp2p identity
11//! wrapper, transports, storage — stays in `huddle-core`, which re-exports the
12//! items here at their original module paths so existing call sites are
13//! unchanged.
14//!
15//! Wire compatibility is a hard invariant: every type here serializes
16//! byte-for-byte as it did before extraction (1.x / 2.x peers and relays are
17//! unaffected). New optional fields use `#[serde(default, skip_serializing_if
18//! = "...")]` so they stay off the wire when unset.
19
20pub mod crypto;
21pub mod error;
22pub mod identity;
23pub mod invite;
24pub mod protocol;
25pub mod relay;
26
27pub use error::{ProtocolError, Result};
28pub use identity::{
29    compute_fingerprint, relay_auth_msg, safety_code, IdentityKeys, RELAY_AUTH_DOMAIN,
30};
31pub use protocol::{
32    EncryptedFileMeta, RoomAnnouncement, RoomKind, RoomMessage, SignedRoomMessage, WireMessage,
33};