pub fn remove_members(
        &mut self,
        backend: &impl OpenMlsCryptoProvider,
        members: &[usize],
    ) -> Result<(MlsMessageOut, Option<Welcome>), ManagedGroupError> {
        if !self.active {
            return Err(ManagedGroupError::UseAfterEviction(UseAfterEviction::Error));
        }

        if members.is_empty() {
            return Err(ManagedGroupError::EmptyInput(
                EmptyInputError::RemoveMembers,
            ));
        }

        // Create add proposals by value
        let proposals = members
            .iter()
            .map(|member| {
                Proposal::Remove(RemoveProposal {
                    removed: *member as u32,
                })
            })
            .collect::<Vec<Proposal>>();
        let proposals_by_value = &proposals.iter().collect::<Vec<&Proposal>>();

        // Include pending proposals
        let proposals_by_reference = &self
            .pending_proposals
            .iter()
            .collect::<Vec<&MlsPlaintext>>();

        let credential = self.credential()?;
        let credential_bundle: CredentialBundle = backend
            .key_store()
            .read(credential.signature_key())
            .ok_or(ManagedGroupError::NoMatchingCredentialBundle)?;

        // Create Commit over all proposals
        // TODO #141
        let (commit, welcome_option, kpb_option) = self.group.create_commit(
            self.framing_parameters(),
            &credential_bundle,
            Proposals {
                proposals_by_reference,
                proposals_by_value,
            },
            false,
            None,
            backend,
        )?;

        // It has to be a full Commit and we have to save the KeyPackageBundle for later
        if let Some(kpb) = kpb_option {
            self.own_kpbs.push(kpb);
        } else {
            return Err(ManagedGroupError::LibraryError(
                "We didn't get a key package for a full commit.".into(),
            ));
        }

        // Convert MlsPlaintext messages to MLSMessage and encrypt them if required by
        // the configuration
        let mls_message = self.plaintext_to_mls_message(commit, backend)?;

        // Since the state of the group was changed, call the auto-save function
        self.auto_save();

        Ok((mls_message, welcome_option))
    }
/// Removes members from the group
///
/// Members are removed by providing the index of their leaf in the tree.
///
/// If successful, it returns a `Vec` of
/// [`MlsMessage`] and an optional [`Welcome`] message if there were add
/// proposals in the queue of pending proposals.
Removes members from the group
Members are removed by providing the index of their leaf in the tree.


Removes members from the group Members are removed by providing the index of their leaf in the tree .
pub fn remove_members(
        &mut self,
        backend: &impl OpenMlsCryptoProvider,
        members: &[usize],
    ) -> Result<(MlsMessageOut, Option<Welcome>), ManagedGroupError> {
        if !self.active {
            return Err(ManagedGroupError::UseAfterEviction(UseAfterEviction::Error));
        }
        if members.is_empty() {
            return Err(ManagedGroupError::EmptyInput(
                EmptyInputError::RemoveMembers,
            ));
        }
        // Create add proposals by value
        let proposals = members
            .iter()
            .map(|member| {
                Proposal::Remove(RemoveProposal {
                    removed: *member as u32,
                })
            })
            .collect::<Vec<Proposal>>();
        let proposals_by_value = &proposals.iter().collect::<Vec<&Proposal>>();
        // Include pending proposals
        let proposals_by_reference = &self
            .pending_proposals
            .iter()
            .collect::<Vec<&MlsPlaintext>>();
        let credential = self.credential()?;
        let credential_bundle: CredentialBundle = backend
            .key_store()
            .read(credential.signature_key())
            .ok_or(ManagedGroupError::NoMatchingCredentialBundle)?;
        // Create Commit over all proposals
        // TODO #141
        let (commit, welcome_option, kpb_option) = self.group.create_commit(
            self.framing_parameters(),
            &credential_bundle,
            Proposals {
                proposals_by_reference,
                proposals_by_value,
            },
            false,
            None,
            backend,
        )?;
        // It has to be a full Commit and we have to save the KeyPackageBundle for later
        if let Some(kpb) = kpb_option {
            self.own_kpbs.push(kpb);
        } else {
            return Err(ManagedGroupError::LibraryError(
                "We didn't get a key package for a full commit.".into(),
            ));
        }
        // Convert MlsPlaintext messages to MLSMessage and encrypt them if required by
        // the configuration
        let mls_message = self.plaintext_to_mls_message(commit, backend)?;
        // Since the state of the group was changed, call the auto-save function
        self.auto_save();
        Ok((mls_message, welcome_option))
    }
pub fn remove_members ( & mut self , backend : & impl OpenMlsCryptoProvider , members : & [ usize ] , ) -> Result < ( MlsMessageOut , Option < Welcome > ) , ManagedGroupError > { if ! self . active { return Err ( ManagedGroupError :: UseAfterEviction ( UseAfterEviction :: Error ) ) ; } if members . is_empty ( ) { return Err ( ManagedGroupError :: EmptyInput ( EmptyInputError :: RemoveMembers , ) ) ; } // Create add proposals by value let proposals = members . iter ( ) . map ( | member | { Proposal :: Remove ( RemoveProposal { removed : * member as u32 , } ) } ) . collect :: < Vec < Proposal > > ( ) ; let proposals_by_value = & proposals . iter ( ) . collect :: < Vec < & Proposal > > ( ) ; // Include pending proposals let proposals_by_reference = & self . pending_proposals . iter ( ) . collect :: < Vec < & MlsPlaintext > > ( ) ; let credential = self . credential ( ) ? ; let credential_bundle : CredentialBundle = backend . key_store ( ) . read ( credential . signature_key ( ) ) . ok_or ( ManagedGroupError :: NoMatchingCredentialBundle ) ? ; // Create Commit over all proposals // TODO #141 let ( commit , welcome_option , kpb_option ) = self . group . create_commit ( self . framing_parameters ( ) , & credential_bundle , Proposals { proposals_by_reference , proposals_by_value , } , false , None , backend , ) ? ; // It has to be a full Commit and we have to save the KeyPackageBundle for later if let Some ( kpb ) = kpb_option { self . own_kpbs . push ( kpb ) ; } else { return Err ( ManagedGroupError :: LibraryError ( " " . into ( ) , ) ) ; } // Convert MlsPlaintext messages to MLSMessage and encrypt them if required by // the configuration let mls_message = self . plaintext_to_mls_message ( commit , backend ) ? ; // Since the state of the group was changed, call the auto-save function self . auto_save ( ) ; Ok ( ( mls_message , welcome_option ) ) }
Removes members from the group
Members are removed by providing the index of their leaf in the tree.
Removes members from the group Members are removed by providing the index of their leaf in the tree .
&mut self
backend
&impl OpenMlsCryptoProvider
members
&[usize]
&mut self
backend
&impl OpenMlsCryptoProvider
members
&[usize]