v0.0.6: Delivery receipts (sent/delivered/read)
Protocol:
- WireMessage::Receipt { sender_fingerprint, message_id, receipt_type }
- ReceiptType enum: Delivered, Read
- id field added to KeyExchange and Message variants
- Receipts are plaintext (not encrypted) — contain only ID + type
Web client:
- Auto-sends Delivered receipt on successful decrypt
- Tracks sent message IDs with receipt status
- Displays: ✓ (sent, gray), ✓✓ (delivered, white), ✓✓ (read, blue)
- Receipt indicators update live via DOM reference
CLI TUI:
- Auto-sends Delivered receipt back to sender on decrypt
- Tracks receipt status per message ID
- Displays receipt indicators after sent messages
WASM:
- create_receipt() function for web client
- encrypt_with_id/encrypt_key_exchange_with_id for tracking
- decrypt_wire_message handles Receipt variant
17/17 protocol tests pass. Zero warnings.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,12 +34,20 @@ pub enum MessageContent {
|
||||
Receipt { message_id: MessageId },
|
||||
}
|
||||
|
||||
/// Receipt type: delivered (received + decrypted) or read (user viewed).
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum ReceiptType {
|
||||
Delivered,
|
||||
Read,
|
||||
}
|
||||
|
||||
/// Wire message format for transport between clients.
|
||||
/// Used by both CLI and WASM — MUST be identical for interop.
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub enum WireMessage {
|
||||
/// First message to a peer: X3DH key exchange + first ratchet message.
|
||||
KeyExchange {
|
||||
id: String,
|
||||
sender_fingerprint: String,
|
||||
sender_identity_encryption_key: [u8; 32],
|
||||
ephemeral_public: [u8; 32],
|
||||
@@ -48,7 +56,14 @@ pub enum WireMessage {
|
||||
},
|
||||
/// Subsequent messages: ratchet-encrypted.
|
||||
Message {
|
||||
id: String,
|
||||
sender_fingerprint: String,
|
||||
ratchet_message: crate::ratchet::RatchetMessage,
|
||||
},
|
||||
/// Delivery / read receipt (plaintext, not encrypted).
|
||||
Receipt {
|
||||
sender_fingerprint: String,
|
||||
message_id: String,
|
||||
receipt_type: ReceiptType,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user