From 8997957639bfe76b53e5f44c96c2e73b2a405d0a Mon Sep 17 00:00:00 2001 From: Jazz Turner-Baggs <473256+jazzz@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:26:27 -0700 Subject: [PATCH] Update config --- .../src/conversation/group_v2.rs | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/core/conversations/src/conversation/group_v2.rs b/core/conversations/src/conversation/group_v2.rs index bb69857..5b8e711 100644 --- a/core/conversations/src/conversation/group_v2.rs +++ b/core/conversations/src/conversation/group_v2.rs @@ -2,6 +2,9 @@ // DeMLS and Libchat have different execution models, trait definitions and ownership/lifetimes of objects. // The easies path is to do a Spike to see what it would take, gather the friction points and then iterate. +use crate::conversation::mls_extensions::{ + ConvoMetaInfo, GROUP_METADATA_EXTENSION_TYPE, capabilities_with_group_metadata, +}; use crate::types::{AddressedEncryptedPayload, ConvoMetadata}; use crate::{Content, WakeupService}; use alloy::signers::local::PrivateKeySigner; @@ -16,9 +19,11 @@ use de_mls::{ defaults::{DefaultConsensusPlugin, DefaultPeerScoring, InMemoryPeerScoreStorage}, }; use hashgraph_like_consensus::signing::EthereumConsensusSigner; +use openmls::extensions::{Extension, Extensions, UnknownExtension}; use openmls::group::MlsGroupCreateConfig; use openmls::prelude::tls_codec::Deserialize as _; use openmls::prelude::{KeyPackageIn, OpenMlsProvider as _, ProtocolVersion}; +use openmls_traits::crypto::OpenMlsCrypto; use prost::Message; use shared_traits::{IdentId, IdentIdRef}; use std::sync::Arc; @@ -95,23 +100,41 @@ fn rand_string(n: usize) -> String { hex::encode(bytes) } -fn group_config() -> MlsGroupCreateConfig { +fn group_config( + cx: &mut ServiceContext, + name: &str, + desc: &str, +) -> MlsGroupCreateConfig { + let meta = ConvoMetaInfo::new(name, cx.mls_identity.id(), desc); + + let extensions = Extensions::from_vec(vec![Extension::Unknown( + GROUP_METADATA_EXTENSION_TYPE, + UnknownExtension(meta.to_extension_bytes()), + )]) + .expect("failed to create extensions"); + MlsGroupCreateConfig::builder() - .use_ratchet_tree_extension(true) + .ciphersuite(cx.mls_provider.crypto().supported_ciphersuites()[0]) + .capabilities(capabilities_with_group_metadata()) + .use_ratchet_tree_extension(true) // Embed the ratchet tree in the Welcome so joiners can build the group + .with_group_context_extensions(extensions) .build() } impl GroupV2Convo { pub fn new( service_ctx: &mut ServiceContext, + name: &str, + desc: &str, ) -> Result { let convo_id = rand_string(5); + let group_config = group_config(service_ctx, name, desc); let conversation = Conversation::create( &convo_id, &member_id(service_ctx), &service_ctx.mls_provider, service_ctx.mls_identity.get_credential(), - &group_config(), + &group_config, &service_ctx.mls_identity, &make_consensus(), make_scoring(),