From 1256e15847577a5d6e77cc5c2b448e7224922e63 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 19 Dec 2024 16:36:45 -0800 Subject: [PATCH] update the hmac keys to return the conversation id --- bindings_ffi/src/mls.rs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index 4ac46b3c1..5540c48f4 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -534,24 +534,6 @@ impl FfiXmtpClient { scw_verifier: self.inner_client.scw_verifier().clone().clone(), })) } - - pub fn get_hmac_keys(&self) -> Result, GenericError> { - let inner = self.inner_client.as_ref(); - let conversations = inner.find_groups(GroupQueryArgs::default())?; - - let mut keys = vec![]; - for conversation in conversations { - let mut k = conversation - .hmac_keys(-1..=1)? - .into_iter() - .map(Into::into) - .collect::>(); - - keys.append(&mut k); - } - - Ok(keys) - } } impl From for FfiHmacKey { @@ -1110,6 +1092,25 @@ impl FfiConversations { FfiStreamCloser::new(handle) } + + pub fn get_hmac_keys(&self) -> Result, Vec>, GenericError> { + let inner = self.inner_client.as_ref(); + let conversations = inner.find_groups(GroupQueryArgs::default())?; + + let mut hmac_map = HashMap::new(); + for conversation in conversations { + let id = conversation.group_id.clone(); + let mut keys = conversation + .hmac_keys(-1..=1)? + .into_iter() + .map(Into::into) + .collect::>(); + + hmac_map.insert(id, keys); + } + + Ok(hmac_map) + } } impl From for ConversationType {