From 8345016f89b14a98d3d8cb696ffe090eeb43f2eb Mon Sep 17 00:00:00 2001 From: Brendan McMillion Date: Sun, 25 Feb 2024 21:48:09 -0800 Subject: [PATCH] Rotate KeyPackage after processing Welcomes --- xmtp_mls/src/client.rs | 6 ++++++ xmtp_mls/src/subscriptions.rs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xmtp_mls/src/client.rs b/xmtp_mls/src/client.rs index 8c91dda0f..7ee4bf913 100644 --- a/xmtp_mls/src/client.rs +++ b/xmtp_mls/src/client.rs @@ -439,6 +439,12 @@ where }) .collect(); + if groups.len() > 0 { + if let Err(err) = self.rotate_key_package().await { + log::error!("Error rotating key package: {:?}", err); + } + } + Ok(groups) } diff --git a/xmtp_mls/src/subscriptions.rs b/xmtp_mls/src/subscriptions.rs index cfad9a7cb..1dec8c7e0 100644 --- a/xmtp_mls/src/subscriptions.rs +++ b/xmtp_mls/src/subscriptions.rs @@ -88,7 +88,12 @@ where }) .filter_map(|res| async { match res.await { - Ok(group) => Some(group), + Ok(group) => { + if let Err(err) = self.rotate_key_package().await { + log::error!("Error rotating key package: {:?}", err); + } + Some(group) + }, Err(err) => { log::error!("Error processing stream entry: {:?}", err); None