mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-04 14:13:23 +00:00
PrivateV1 was the legacy prekey-handshake 1:1 protocol, superseded by DirectV1 over InboxV2. Remove it and everything that existed only to serve it. - Delete PrivateV1Convo and its v1 inbox bootstrap: the Inbox, Introduction, and InboxHandshake types, plus the support code only they used (the crate::crypto module, EncryptionError, timestamp_millis, the PrivateV1Domain HKDF domain, and the ServiceContext test doubles). - Drop the public entry points that exposed it: Core::create_intro_bundle, create_private_convo_v1, dispatch_to_inbox, and the matching ChatClient::create_intro_bundle / create_conversation. - Remove ConversationKind::PrivateV1 and its "private_v1" mapping, the from_kind arm, and the orphaned inbox-v1 proto re-exports. - Migrate the chat-cli /intro and /connect commands and the message-exchange example to create_direct_conversation. - Delete the PrivateV1 integration test; move the sqlite conversation roundtrip test to GroupV1. InboxOutcome, PayloadOutcome::Inbox, and ConversationClass::Private stay: InboxV2 (DirectV1 and GroupV1 invites) still produces them. Follow-ups, out of scope here: - logos-chat-module still calls create_intro_bundle / create_conversation and needs a companion change. - remote_convo_id and EphemeralKeyStore are now vestigial (only PrivateV1 used them); dropping them is a storage-schema change for a later PR.
Double Ratchet
This library provides an implementation of the Double Ratchet algorithm.
Usage
let shared_secret = [42u8; 32];
let bob_dh = DhKeyPair::generate();
let mut alice = RatchetState::init_sender(shared_secret, bob_dh.public);
let mut bob = RatchetState::init_receiver(shared_secret, bob_dh);
let (ciphertext, header) = alice.encrypt_message(b"Hello Bob!");
let plaintext = bob.decrypt_message(&ciphertext, header);
Run examples,
cargo run --example double_ratchet_basic
cargo run --example storage_demo --features storage
cargo run --example storage_demo --features sqlcipher