diff --git a/openmls/src/group/core_group/mod.rs b/openmls/src/group/core_group/mod.rs index 11f9f3dea..a78fff0fc 100644 --- a/openmls/src/group/core_group/mod.rs +++ b/openmls/src/group/core_group/mod.rs @@ -1135,13 +1135,12 @@ impl CoreGroup { } /// Create a new group context extension proposal - pub(crate) fn create_group_context_ext_proposal( + pub(crate) fn create_group_context_ext_proposal( &self, framing_parameters: FramingParameters, extensions: Extensions, signer: &impl Signer, - ) -> Result> - { + ) -> Result { // Ensure that the group supports all the extensions that are wanted. let required_extension = extensions .iter() diff --git a/openmls/src/group/core_group/test_proposals.rs b/openmls/src/group/core_group/test_proposals.rs index 240c990bd..ca166ea72 100644 --- a/openmls/src/group/core_group/test_proposals.rs +++ b/openmls/src/group/core_group/test_proposals.rs @@ -512,7 +512,10 @@ fn test_group_context_extension_proposal_fails( } #[openmls_test::openmls_test] -fn test_group_context_extension_proposal(ciphersuite: Ciphersuite, provider: &Provider) { +fn test_group_context_extension_proposal( + ciphersuite: Ciphersuite, + provider: &impl crate::storage::OpenMlsProvider, +) { // Basic group setup. let group_aad = b"Alice's test group"; let framing_parameters = FramingParameters::new(group_aad, WireFormat::PublicMessage); @@ -583,7 +586,7 @@ fn test_group_context_extension_proposal(ciphersuite: Ciphersuite, provider: &Pr &[CredentialType::Basic], )); let gce_proposal = alice_group - .create_group_context_ext_proposal::( + .create_group_context_ext_proposal( framing_parameters, Extensions::single(required_application_id), &alice_signer, diff --git a/openmls/src/group/errors.rs b/openmls/src/group/errors.rs index 50e2e8317..37a9a72ad 100644 --- a/openmls/src/group/errors.rs +++ b/openmls/src/group/errors.rs @@ -500,7 +500,7 @@ pub(crate) enum CoreGroupParseMessageError { /// Create group context ext proposal error #[derive(Error, Debug, PartialEq, Clone)] -pub enum CreateGroupContextExtProposalError { +pub enum CreateGroupContextExtProposalError { /// See [`LibraryError`] for more details. #[error(transparent)] LibraryError(#[from] LibraryError), @@ -513,12 +513,6 @@ pub enum CreateGroupContextExtProposalError { /// See [`LeafNodeValidationError`] for more details. #[error(transparent)] LeafNodeValidation(#[from] LeafNodeValidationError), - /// See [`MlsGroupStateError`] for more details. - #[error(transparent)] - MlsGroupStateError(#[from] MlsGroupStateError), - /// See [`CreateCommitError`] for more details. - #[error(transparent)] - CreateCommitError(#[from] CreateCommitError), } /// Error merging a commit. @@ -543,15 +537,6 @@ pub enum GroupContextExtensionsProposalValidationError { #[error(transparent)] LibraryError(#[from] LibraryError), - /// The new extension types in required capabilties contails extensions that are not supported by all group members. - #[error( - "The new required capabilties contain extension types that are not supported by all group members." - )] - ExtensionNotSupportedByAllMembers, - /// Proposal changes the immutable metadata extension, which is not allowed. - #[error("Proposal changes the immutable metadata extension, which is not allowed.")] - ChangedImmutableMetadata, - /// The new extension types in required capabilties contails extensions that are not supported by all group members. #[error( "The new required capabilties contain extension types that are not supported by all group members." diff --git a/openmls/src/group/mls_group/errors.rs b/openmls/src/group/mls_group/errors.rs index abf94bdbe..b260b4944 100644 --- a/openmls/src/group/mls_group/errors.rs +++ b/openmls/src/group/mls_group/errors.rs @@ -340,7 +340,7 @@ pub enum ProposalError { ValidationError(#[from] ValidationError), /// See [`CreateGroupContextExtProposalError`] for more details. #[error(transparent)] - CreateGroupContextExtProposalError(#[from] CreateGroupContextExtProposalError), + CreateGroupContextExtProposalError(#[from] CreateGroupContextExtProposalError), /// Error writing proposal to storage. #[error("error writing proposal to storage")] StorageError(StorageError), diff --git a/openmls/src/group/mls_group/membership.rs b/openmls/src/group/mls_group/membership.rs index b22c723ed..0416b4bfd 100644 --- a/openmls/src/group/mls_group/membership.rs +++ b/openmls/src/group/mls_group/membership.rs @@ -214,23 +214,6 @@ impl MlsGroup { .leaf(leaf_index) .map(|leaf| leaf.credential()) } - - /// Returns the [`Member`] corresponding to the given - /// leaf index. Returns `None` if the member can not be found in this group. - pub fn member_at(&self, leaf_index: LeafNodeIndex) -> Option { - self.group - .public_group() - // This will return an error if the member can't be found. - .leaf(leaf_index) - .map(|leaf_node| { - Member::new( - leaf_index, - leaf_node.encryption_key().as_slice().to_vec(), - leaf_node.signature_key().as_slice().to_vec(), - leaf_node.credential().clone(), - ) - }) - } } /// Helper `enum` that classifies the kind of remove operation. This can be used to diff --git a/openmls/src/group/mls_group/proposal.rs b/openmls/src/group/mls_group/proposal.rs index b76a46bd3..19bfd78d5 100644 --- a/openmls/src/group/mls_group/proposal.rs +++ b/openmls/src/group/mls_group/proposal.rs @@ -1,10 +1,8 @@ use openmls_traits::{signatures::Signer, storage::StorageProvider, types::Ciphersuite}; use super::{ - core_group::create_commit_params::CreateCommitParams, errors::{ProposalError, ProposeAddMemberError, ProposeRemoveMemberError}, - CreateGroupContextExtProposalError, CustomProposal, GroupContextExtensionProposal, MlsGroup, - MlsGroupState, PendingCommitState, Proposal, + CustomProposal, MlsGroup, }; use crate::{ binary_tree::LeafNodeIndex, @@ -14,7 +12,7 @@ use crate::{ framing::MlsMessageOut, group::{errors::CreateAddProposalError, GroupId, QueuedProposal}, key_packages::KeyPackage, - messages::{group_info::GroupInfo, proposals::ProposalOrRefType}, + messages::proposals::ProposalOrRefType, prelude::LibraryError, schedule::PreSharedKeyId, storage::OpenMlsProvider, @@ -363,7 +361,7 @@ impl MlsGroup { ) -> Result<(MlsMessageOut, ProposalRef), ProposalError> { self.is_operational()?; - let proposal = self.group.create_group_context_ext_proposal::( + let proposal = self.group.create_group_context_ext_proposal( self.framing_parameters(), extensions, signer, @@ -386,46 +384,4 @@ impl MlsGroup { Ok((mls_message, proposal_ref)) } - - /// Updates group context extensions - /// - /// Returns an error when the group does not support all the required capabilities - /// in the new `extensions`. - #[allow(clippy::type_complexity)] - pub fn update_group_context_extensions( - &mut self, - provider: &Provider, - extensions: Extensions, - signer: &impl Signer, - ) -> Result< - (MlsMessageOut, Option, Option), - CreateGroupContextExtProposalError, - > { - self.is_operational()?; - - // Create group context extension proposals - let inline_proposals = vec![Proposal::GroupContextExtensions( - GroupContextExtensionProposal { extensions }, - )]; - - let params = CreateCommitParams::builder() - .framing_parameters(self.framing_parameters()) - .proposal_store(&self.proposal_store) - .inline_proposals(inline_proposals) - .build(); - let create_commit_result = self.group.create_commit(params, provider, signer)?; - - let mls_messages = self.content_to_mls_message(create_commit_result.commit, provider)?; - self.group_state = MlsGroupState::PendingCommit(Box::new(PendingCommitState::Member( - create_commit_result.staged_commit, - ))); - - Ok(( - mls_messages, - create_commit_result - .welcome_option - .map(|w| MlsMessageOut::from_welcome(w, self.group.version())), - create_commit_result.group_info, - )) - } }