osmaczko 37ae88bfa7
chore: remove the unused PrivateV1 conversation stack (#176)
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.
2026-07-16 10:40:23 +02:00

70 lines
2.4 KiB
Rust

use components::EphemeralRegistry;
use logos_account::TestLogosAccount;
use logos_generic_chat::{ChatClientBuilder, DelegateSigner, Event, InProcessDelivery, MessageBus};
use std::time::Duration;
fn main() {
let bus = MessageBus::default();
let mut reg = EphemeralRegistry::new();
// Mint two accounts, each with a delegate signer, and publish their device
// bundles so a peer can resolve an account address to its device.
let saro_account = TestLogosAccount::new();
let saro_delegate = DelegateSigner::random();
saro_account
.add_delegate_signer(&mut reg, saro_delegate.public_key())
.unwrap();
let raya_account = TestLogosAccount::new();
let raya_delegate = DelegateSigner::random();
raya_account
.add_delegate_signer(&mut reg, raya_delegate.public_key())
.unwrap();
let (mut saro, saro_events) = ChatClientBuilder::new(saro_account.address())
.ident(saro_delegate)
.transport(InProcessDelivery::new(bus.clone()))
.registration(reg.clone())
.build()
.unwrap();
let (mut raya, raya_events) = ChatClientBuilder::new(raya_account.address())
.ident(raya_delegate)
.transport(InProcessDelivery::new(bus))
.registration(reg)
.build()
.unwrap();
// Saro opens a direct conversation with Raya by her account address.
let saro_convo_id = saro.create_direct_conversation(raya.addr()).unwrap();
// Wait for Raya to process the Welcome and subscribe before Saro sends, since
// InProcessDelivery only fans out to current subscribers.
let raya_convo_id = match raya_events.recv_timeout(Duration::from_secs(5)).unwrap() {
Event::ConversationStarted { convo_id, .. } => convo_id,
other => panic!("expected ConversationStarted, got {other:?}"),
};
saro.send_message(&saro_convo_id, b"hello raya").unwrap();
if let Event::MessageReceived { content, .. } =
raya_events.recv_timeout(Duration::from_secs(5)).unwrap()
{
println!(
"Raya received: {:?}",
std::str::from_utf8(&content).unwrap()
);
}
raya.send_message(&raya_convo_id, b"hi saro").unwrap();
if let Event::MessageReceived { content, .. } =
saro_events.recv_timeout(Duration::from_secs(5)).unwrap()
{
println!(
"Saro received: {:?}",
std::str::from_utf8(&content).unwrap()
);
}
println!("Message exchange complete.");
}