diff --git a/openmls/src/group/core_group/mod.rs b/openmls/src/group/core_group/mod.rs index ed9eaefb8..af0dca416 100644 --- a/openmls/src/group/core_group/mod.rs +++ b/openmls/src/group/core_group/mod.rs @@ -1045,12 +1045,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 c1972e08a..41ac185d2 100644 --- a/openmls/src/group/core_group/test_proposals.rs +++ b/openmls/src/group/core_group/test_proposals.rs @@ -1,5 +1,5 @@ use openmls_rust_crypto::OpenMlsRustCrypto; -use openmls_traits::{types::Ciphersuite, OpenMlsProvider}; +use openmls_traits::{key_store::OpenMlsKeyStore, types::Ciphersuite, OpenMlsProvider}; use super::CoreGroup; use crate::{ @@ -543,9 +543,9 @@ fn test_group_context_extension_proposal_fails( } #[apply(ciphersuites_and_providers)] -fn test_group_context_extension_proposal( +fn test_group_context_extension_proposal( ciphersuite: Ciphersuite, - provider: &impl OpenMlsProvider, + provider: &impl OpenMlsProvider, ) { // Basic group setup. let group_aad = b"Alice's test group"; @@ -617,7 +617,7 @@ fn test_group_context_extension_proposal( &[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 6d09b153b..b316fc62d 100644 --- a/openmls/src/group/errors.rs +++ b/openmls/src/group/errors.rs @@ -494,7 +494,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), @@ -509,6 +509,8 @@ pub enum CreateGroupContextExtProposalError { LeafNodeValidation(#[from] LeafNodeValidationError), #[error(transparent)] GroupStateError(#[from] MlsGroupStateError), + #[error(transparent)] + CreateCommitError(#[from] CreateCommitError), } /// Error merging a commit. diff --git a/openmls/src/group/mls_group/errors.rs b/openmls/src/group/mls_group/errors.rs index 2b7a4fc20..01d4c8274 100644 --- a/openmls/src/group/mls_group/errors.rs +++ b/openmls/src/group/mls_group/errors.rs @@ -322,5 +322,5 @@ pub enum ProposalError { ValidationError(#[from] ValidationError), /// See [`CreateGroupContextExtProposalError`] for more details. #[error(transparent)] - CreateGroupContextExtProposalError(#[from] CreateGroupContextExtProposalError), + CreateGroupContextExtProposalError(#[from] CreateGroupContextExtProposalError), } diff --git a/openmls/src/group/mls_group/proposal.rs b/openmls/src/group/mls_group/proposal.rs index 6cfffc3ea..82b34e78e 100644 --- a/openmls/src/group/mls_group/proposal.rs +++ b/openmls/src/group/mls_group/proposal.rs @@ -325,15 +325,15 @@ impl MlsGroup { /// /// Returns an error when the group does not support all the required capabilities /// in the new `extensions`. - pub fn propose_group_context_extensions( + pub fn propose_group_context_extensions( &mut self, - provider: &impl OpenMlsProvider, + provider: &impl OpenMlsProvider, extensions: Extensions, signer: &impl Signer, - ) -> Result<(MlsMessageOut, ProposalRef), ProposalError<()>> { + ) -> 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, @@ -356,14 +356,18 @@ impl MlsGroup { Ok((mls_message, proposal_ref)) } - pub fn update_group_context_extensions( + /// Updates group context extensions + /// + /// Returns an error when the group does not support all the required capabilities + /// in the new `extensions`. + pub fn update_group_context_extensions( &mut self, - provider: &impl OpenMlsProvider, + provider: &impl OpenMlsProvider, extensions: Extensions, signer: &impl Signer, ) -> Result< (MlsMessageOut, Option, Option), - CreateGroupContextExtProposalError, + CreateGroupContextExtProposalError, > { self.is_operational()?; @@ -377,7 +381,7 @@ impl MlsGroup { .proposal_store(&self.proposal_store) .inline_proposals(inline_proposals) .build(); - let create_commit_result = self.group.create_commit(params, provider, signer).unwrap(); + 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(