pub fn propose_self_update(
        &mut self,
        backend: &impl OpenMlsCryptoProvider,
        key_package_bundle_option: Option<KeyPackageBundle>,
    ) -> Result<MlsMessageOut, ManagedGroupError> {
        if !self.active {
            return Err(ManagedGroupError::UseAfterEviction(UseAfterEviction::Error));
        }

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

        let tree = self.group.tree();
        let existing_key_package = tree.own_key_package();
        let key_package_bundle = match key_package_bundle_option {
            Some(kpb) => kpb,
            None => {
                KeyPackageBundlePayload::from_rekeyed_key_package(existing_key_package, backend)
                    .sign(backend, &credential_bundle)?
            }
        };

        let update_proposal = self.group.create_update_proposal(
            self.framing_parameters(),
            &credential_bundle,
            key_package_bundle.key_package().clone(),
            backend,
        )?;
        drop(tree);

        self.own_kpbs.push(key_package_bundle);

        let mls_message = self.plaintext_to_mls_message(update_proposal, backend)?;

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

        Ok(mls_message)
    }
/// Creates a proposal to update the own leaf node
Creates a proposal to update the own leaf node
Creates a proposal to update the own leaf node
pub fn propose_self_update(
        &mut self,
        backend: &impl OpenMlsCryptoProvider,
        key_package_bundle_option: Option<KeyPackageBundle>,
    ) -> Result<MlsMessageOut, ManagedGroupError> {
        if !self.active {
            return Err(ManagedGroupError::UseAfterEviction(UseAfterEviction::Error));
        }
        let credential = self.credential()?;
        let credential_bundle: CredentialBundle = backend
            .key_store()
            .read(credential.signature_key())
            .ok_or(ManagedGroupError::NoMatchingCredentialBundle)?;
        let tree = self.group.tree();
        let existing_key_package = tree.own_key_package();
        let key_package_bundle = match key_package_bundle_option {
            Some(kpb) => kpb,
            None => {
                KeyPackageBundlePayload::from_rekeyed_key_package(existing_key_package, backend)
                    .sign(backend, &credential_bundle)?
            }
        };
        let update_proposal = self.group.create_update_proposal(
            self.framing_parameters(),
            &credential_bundle,
            key_package_bundle.key_package().clone(),
            backend,
        )?;
        drop(tree);
        self.own_kpbs.push(key_package_bundle);
        let mls_message = self.plaintext_to_mls_message(update_proposal, backend)?;
        // Since the state of the group was changed, call the auto-save function
        self.auto_save();
        Ok(mls_message)
    }
pub fn propose_self_update ( & mut self , backend : & impl OpenMlsCryptoProvider , key_package_bundle_option : Option < KeyPackageBundle > , ) -> Result < MlsMessageOut , ManagedGroupError > { if ! self . active { return Err ( ManagedGroupError :: UseAfterEviction ( UseAfterEviction :: Error ) ) ; } let credential = self . credential ( ) ? ; let credential_bundle : CredentialBundle = backend . key_store ( ) . read ( credential . signature_key ( ) ) . ok_or ( ManagedGroupError :: NoMatchingCredentialBundle ) ? ; let tree = self . group . tree ( ) ; let existing_key_package = tree . own_key_package ( ) ; let key_package_bundle = match key_package_bundle_option { Some ( kpb ) => kpb , None => { KeyPackageBundlePayload :: from_rekeyed_key_package ( existing_key_package , backend ) . sign ( backend , & credential_bundle ) ? } } ; let update_proposal = self . group . create_update_proposal ( self . framing_parameters ( ) , & credential_bundle , key_package_bundle . key_package ( ) . clone ( ) , backend , ) ? ; drop ( tree ) ; self . own_kpbs . push ( key_package_bundle ) ; let mls_message = self . plaintext_to_mls_message ( update_proposal , backend ) ? ; // Since the state of the group was changed, call the auto-save function self . auto_save ( ) ; Ok ( mls_message ) }
Creates a proposal to update the own leaf node
Creates a proposal to update the own leaf node
&mut self
backend
&impl OpenMlsCryptoProvider
key_package_bundle_option
Option<KeyPackageBundle>
&mut self
backend
&impl OpenMlsCryptoProvider
key_package_bundle_option
Option<KeyPackageBundle>