v0.0.13: Sender Keys for efficient group encryption

Protocol (sender_keys.rs):
- SenderKey: symmetric key with chain ratchet (forward secrecy per chain)
- generate(), rotate(), encrypt(), decrypt()
- SenderKeyDistribution: share key via 1:1 encrypted channel
- SenderKeyMessage: encrypted group message (O(1) instead of O(N))
- Chain key ratchets forward on each message (HKDF)
- Generation counter for key rotation tracking
- 4 tests: basic, multi-message, rotation, old-key rejection

WireMessage:
- GroupSenderKey variant: encrypted group message
- SenderKeyDistribution variant: key sharing

Server: dedup handles new variants.
CLI TUI + recv: stub handlers for new message types.
23/23 protocol tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-27 13:23:10 +04:00
parent 653c6c050b
commit 86da52acc4
9 changed files with 280 additions and 6 deletions

View File

@@ -84,4 +84,21 @@ pub enum WireMessage {
total_chunks: u32,
data: Vec<u8>,
},
/// Group message encrypted with sender key (O(1) instead of O(N)).
GroupSenderKey {
id: String,
sender_fingerprint: String,
group_name: String,
generation: u32,
counter: u32,
ciphertext: Vec<u8>,
},
/// Sender key distribution: share your sender key with a group member.
/// This is sent via 1:1 encrypted channel (wrapped in KeyExchange/Message).
SenderKeyDistribution {
sender_fingerprint: String,
group_name: String,
chain_key: [u8; 32],
generation: u32,
},
}