Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marta Mularczyk committed Jan 9, 2025
1 parent 467c7c4 commit 60bf501
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 38 deletions.
4 changes: 3 additions & 1 deletion mls-rs/src/group/proposal_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3577,7 +3577,9 @@ mod tests {

#[cfg_attr(not(mls_build_async), maybe_async::must_be_sync)]
async fn unsupported_credential_key_package(name: &str) -> KeyPackage {
let (client, _) = test_client_with_key_pkg(TEST_PROTOCOL_VERSION, TEST_CIPHER_SUITE, name);
let (client, _) =
test_client_with_key_pkg(TEST_PROTOCOL_VERSION, TEST_CIPHER_SUITE, name).await;

let mut kp_builder = client.key_package_builder(None).unwrap();

kp_builder.signing_data.signing_identity.credential =
Expand Down
40 changes: 7 additions & 33 deletions mls-rs/src/group/state_repo_light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,24 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

use crate::client::MlsError;
use crate::key_package::KeyPackageRef;

use alloc::vec::Vec;
use mls_rs_codec::MlsEncode;
use mls_rs_core::{
error::IntoAnyError,
group::{GroupState, GroupStateStorage},
key_package::KeyPackageStorage,
};

use super::snapshot::Snapshot;

#[derive(Debug, Clone)]
pub(crate) struct GroupStateRepository<S, K>
where
S: GroupStateStorage,
K: KeyPackageStorage,
{
pending_key_package_removal: Option<KeyPackageRef>,
pub(crate) struct GroupStateRepository<S: GroupStateStorage> {
storage: S,
key_package_repo: K,
}

impl<S, K> GroupStateRepository<S, K>
where
S: GroupStateStorage,
K: KeyPackageStorage,
{
pub fn new(storage: S, key_package_repo: K) -> Result<GroupStateRepository<S, K>, MlsError> {
Ok(GroupStateRepository {
storage,
pending_key_package_removal: None,
key_package_repo,
})
impl<S: GroupStateStorage> GroupStateRepository<S> {
pub fn new(storage: S) -> Result<GroupStateRepository<S>, MlsError> {
Ok(GroupStateRepository { storage })
}

#[cfg_attr(not(mls_build_async), maybe_async::must_be_sync)]
Expand All @@ -51,13 +35,6 @@ where
.await
.map_err(|e| MlsError::GroupStorageError(e.into_any_error()))?;

if let Some(ref key_package_ref) = self.pending_key_package_removal {
self.key_package_repo
.delete(key_package_ref)
.await
.map_err(|e| MlsError::KeyPackageRepoError(e.into_any_error()))?;
}

Ok(())
}
}
Expand All @@ -70,7 +47,7 @@ mod tests {
snapshot::{test_utils::get_test_snapshot, Snapshot},
test_utils::{test_member, TEST_GROUP},
},
storage_provider::in_memory::{InMemoryGroupStateStorage, InMemoryKeyPackageStorage},
storage_provider::in_memory::InMemoryGroupStateStorage,
};

use alloc::vec;
Expand All @@ -84,11 +61,8 @@ mod tests {

#[maybe_async::test(not(mls_build_async), async(mls_build_async, crate::futures_test))]
async fn test_stored_groups_list() {
let mut test_repo = GroupStateRepository::new(
InMemoryGroupStateStorage::default(),
InMemoryKeyPackageStorage::default(),
)
.unwrap();
let mut test_repo =
GroupStateRepository::new(InMemoryGroupStateStorage::default()).unwrap();

test_repo
.write_to_storage(test_snapshot(0).await)
Expand Down
7 changes: 3 additions & 4 deletions mls-rs/src/group/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// Copyright by contributors to this project.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

use mls_rs_core::{
error::IntoAnyError,
identity::{IdentityProvider, SigningIdentity},
};
use mls_rs_core::identity::{IdentityProvider, SigningIdentity};

use crate::{
cipher_suite::CipherSuite,
Expand All @@ -19,6 +16,8 @@ use crate::{

#[cfg(feature = "by_ref_proposal")]
use crate::extension::ExternalSendersExt;
#[cfg(feature = "by_ref_proposal")]
use mls_rs_core::error::IntoAnyError;

use super::{
message_signature::AuthenticatedContent, transcript_hash::InterimTranscriptHash,
Expand Down

0 comments on commit 60bf501

Please sign in to comment.