Skip to content

Commit

Permalink
added function comments and updated formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Apr 10, 2024
1 parent 8c58f21 commit 7ed6765
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion openmls/src/group/core_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ impl CoreGroup {
})
}

/// Create a new group context extension proposal
pub(crate) fn create_group_context_ext_proposal(
&self,
framing_parameters: FramingParameters,
Expand Down Expand Up @@ -1083,7 +1084,6 @@ impl CoreGroup {
// Test functions
#[cfg(test)]
impl CoreGroup {

pub(crate) fn use_ratchet_tree_extension(&self) -> bool {
self.use_ratchet_tree_extension
}
Expand Down
26 changes: 17 additions & 9 deletions openmls/src/group/mls_group/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use openmls_traits::{
};

use super::{
core_group, errors::{ProposalError, ProposeAddMemberError, ProposeRemoveMemberError}, CreateGroupContextExtProposalError, GroupContextExtensionProposal, GroupContextExtensionsProposalValidationError, MlsGroup, MlsGroupState, PendingCommitState, Proposal
core_group,
errors::{ProposalError, ProposeAddMemberError, ProposeRemoveMemberError},
CreateGroupContextExtProposalError, GroupContextExtensionProposal, MlsGroup, MlsGroupState,
PendingCommitState, Proposal,
};
use crate::{
binary_tree::LeafNodeIndex,
Expand Down Expand Up @@ -319,6 +322,10 @@ impl MlsGroup {
}
}

/// Creates a proposals with a new set of `extensions` for the group context.
///
/// Returns an error when the group does not support all the required capabilities
/// in the new `extensions`.
pub fn propose_group_context_extensions(
&mut self,
provider: &impl OpenMlsProvider,
Expand Down Expand Up @@ -355,23 +362,24 @@ impl MlsGroup {
provider: &impl OpenMlsProvider,
extensions: Extensions,
signer: &impl Signer,
) -> Result<(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>), CreateGroupContextExtProposalError>
{
) -> Result<
(MlsMessageOut, Option<MlsMessageOut>, Option<GroupInfo>),
CreateGroupContextExtProposalError,
> {
self.is_operational()?;

// Create inline add proposals from key packages
let mut inline_proposals = vec![];
inline_proposals.push(Proposal::GroupContextExtensions(GroupContextExtensionProposal {
extensions,
}));
// 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).unwrap();

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,
Expand Down

0 comments on commit 7ed6765

Please sign in to comment.