Skip to main content

zrtp/
lib.rs

1#![forbid(unsafe_code)]
2#![doc = r#"
3RFC 6189 ZRTP protocol core, crypto helpers, and embeddable engine.
4
5# Modules
6
7- `wire`: packet/message framing and typed protocol structures
8- `crypto`: hash/KDF/Confirm/DH/ECDH helpers
9- `cache`: retained shared-secret storage primitives
10- `engine`: embeddable handshake state and retransmission helpers
11
12# Feature flags
13
14- `crypto` (enabled by default): hash/KDF, Confirm encryption/MAC, DH/ECDH,
15  SAS rendering, and crypto-backed handshake paths.
16- Without default features, the crate remains usable for wire/message parsing,
17  packet framing, negotiation data structures, retransmission helpers, and cache
18  primitives. Crypto-backed APIs return `Error::Unsupported`.
19
20# Example
21
22```rust
23use zrtp::*;
24
25let hello = Hello {
26    version: VERSION_1_10,
27    client_id: *b"example-zrtp    ",
28    hash_image_h3: [0; 32],
29    zid: [1; 12],
30    signature_capable: false,
31    mitm_capable: false,
32    passive_capable: false,
33    hashes: vec![algos::HASH_S256],
34    ciphers: vec![algos::CIPHER_AES1],
35    auth_tags: vec![algos::AUTH_HS32],
36    key_agreements: vec![algos::KEYAGREE_EC25],
37    sas_types: vec![algos::SAS_B32],
38    mac: [0; 8],
39};
40
41let mut engine = ZrtpEngine::new(Role::Initiator, hello, MemorySharedSecretStore::default());
42let outbound = engine.start();
43assert!(!outbound.is_empty());
44```
45"#]
46
47pub mod cache;
48pub mod crypto;
49pub mod engine;
50pub mod wire;
51
52pub use cache::*;
53pub use crypto::*;
54pub use engine::*;
55pub use wire::*;