diff --git a/crypto/src/mls/conversation/wipe.rs b/crypto/src/mls/conversation/wipe.rs index 40057f0f7e..244dc02bc0 100644 --- a/crypto/src/mls/conversation/wipe.rs +++ b/crypto/src/mls/conversation/wipe.rs @@ -1,7 +1,6 @@ -use crate::prelude::{ConversationId, CryptoResult, MlsCentral, MlsConversation}; -use core_crypto_keystore::{entities::MlsEncryptionKeyPair, CryptoKeystoreMls}; +use crate::prelude::{ConversationId, CryptoResult, MlsCentral, MlsConversation, MlsError}; +use core_crypto_keystore::CryptoKeystoreMls; use mls_crypto_provider::MlsCryptoProvider; -use openmls::prelude::Proposal; use openmls_traits::OpenMlsCryptoProvider; impl MlsCentral { @@ -29,11 +28,13 @@ impl MlsConversation { // Since it is a terminal operation, ignoring the error is fine here. let _ = self.group.delete_previous_epoch_keypairs(backend).await; - for proposal in self.group.pending_proposals() { + let pending_proposals = self.group.pending_proposals().cloned().collect::>(); + for proposal in pending_proposals { // Update proposals rekey the own leaf node. Hence the associated encryption keypair has to be cleared self.group .remove_pending_proposal(backend.key_store(), proposal.proposal_reference()) - .await?; + .await + .map_err(MlsError::from)?; } Ok(()) diff --git a/crypto/src/mls/external_commit.rs b/crypto/src/mls/external_commit.rs index 1f5ad07c2b..0423a1d8e6 100644 --- a/crypto/src/mls/external_commit.rs +++ b/crypto/src/mls/external_commit.rs @@ -652,6 +652,8 @@ pub mod tests { .await .unwrap(); + let initial_count = alice_central.count_entities().await; + // export Alice group info let group_info = alice_central.get_group_info(&id).await; @@ -664,6 +666,9 @@ pub mod tests { // But for some reason, Bob wants to abort joining the group bob_central.clear_pending_group_from_external_commit(&id).await.unwrap(); + let final_count = alice_central.count_entities().await; + assert_eq!(initial_count, final_count); + // Hence trying to merge the pending should fail let result = bob_central.merge_pending_group_from_external_commit(&id).await; assert!(matches!( diff --git a/keystore/src/entities/platform/generic/mls/epoch_encryption_keypair.rs b/keystore/src/entities/platform/generic/mls/epoch_encryption_keypair.rs index d863d6b895..c1898dd189 100644 --- a/keystore/src/entities/platform/generic/mls/epoch_encryption_keypair.rs +++ b/keystore/src/entities/platform/generic/mls/epoch_encryption_keypair.rs @@ -86,8 +86,6 @@ impl EntityBase for MlsEpochEncryptionKeyPair { async fn save(&self, conn: &mut Self::ConnectionType) -> crate::CryptoKeystoreResult<()> { use rusqlite::OptionalExtension as _; - println!("+ {}", hex::encode(&self.id)); - Self::ConnectionType::check_buffer_size(self.id.len())?; Self::ConnectionType::check_buffer_size(self.keypairs.len())?; @@ -202,7 +200,6 @@ impl EntityBase for MlsEpochEncryptionKeyPair { let len = ids.len(); let mut updated = 0; for id in ids { - println!("- {}", hex::encode(id.as_slice())); updated += transaction.execute( "DELETE FROM mls_epoch_encryption_keypairs WHERE id = ?", [id.as_slice()],