Add 1:1 Chats using Groups (#139)

* Add Identified Trait for convo

* Add PrivateV2Convo

* Rename to DirectV1

* Rename ConvoTypeOwned variant

* Update DirectV1 to support multiple members

* Apply suggestion from @kaichaosun

Co-authored-by: kaichao <kaichaosuna@gmail.com>

---------

Co-authored-by: kaichao <kaichaosuna@gmail.com>
This commit is contained in:
Jazz Turner-Baggs
2026-06-19 12:01:17 -07:00
committed by GitHub
co-authored by kaichao
parent c5b264c827
commit 7612b233c9
7 changed files with 156 additions and 8 deletions
@@ -87,7 +87,7 @@ fn ctx_integration() {
// Saro initiates conversation with Raya
let mut content = vec![10];
let saro_convo_id = saro.create_private_convo(&intro, &content).unwrap();
let saro_convo_id = saro.create_private_convo_v1(&intro, &content).unwrap();
// Raya receives the invite + initial message
let initial = recv_one(&mut raya);
@@ -178,7 +178,7 @@ fn conversation_metadata_persistence() {
let bundle = alice.create_intro_bundle().unwrap();
let intro = Introduction::try_from(bundle.as_slice()).unwrap();
bob.create_private_convo(&intro, b"hi").unwrap();
bob.create_private_convo_v1(&intro, b"hi").unwrap();
let result = recv_one(&mut alice);
let PayloadOutcome::Inbox(io) = result else {
@@ -219,7 +219,7 @@ fn conversation_full_flow() {
let bundle = alice.create_intro_bundle().unwrap();
let intro = Introduction::try_from(bundle.as_slice()).unwrap();
let bob_convo_id = bob.create_private_convo(&intro, b"hello").unwrap();
let bob_convo_id = bob.create_private_convo_v1(&intro, b"hello").unwrap();
let result = recv_one(&mut alice);
let PayloadOutcome::Inbox(io) = result else {
@@ -0,0 +1,43 @@
use integration_tests_core::TestHarness;
use tracing::info;
#[test]
fn happypath_roundtrip() {
let _ = tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.with_test_writer()
.try_init();
const S_M1: &[u8] = b"Marco";
const R_M1: &[u8] = b"Polo";
// Initialize TestHarness with 2 clients
let mut harness = TestHarness::<2>::new(|_, _| {});
//Saro Create Convo
let particpant = harness.raya().addr();
let convo_id = harness
.saro()
.create_direct_convo_v1(&[&particpant])
.expect("saro create group");
// Carry the invite through (commit, WelcomeReady, routing to Raya's inbox,
// accept_welcome); settle until Raya has joined.
harness.process_until_label("Saro Send", |h| h.raya().convo_count() == 1);
// Saro sends a message; settle until Raya receives it.
info!(target: "chat", "Saro -> sending: {S_M1:?}");
harness
.saro()
.send_content(&convo_id, S_M1)
.expect("saro send");
harness.process_until(|h| h.raya().check(&convo_id, S_M1));
// Raya replies; settle until Saro receives it.
info!(target: "chat", "Raya -> sending:{R_M1:?}");
harness.raya().send_content(&convo_id, R_M1).unwrap();
harness.process_until(|h| h.saro().check(&convo_id, R_M1));
assert!(harness.saro().check(&convo_id, R_M1));
}