pub fn new_from_welcome(
        backend: &impl OpenMlsCryptoProvider,
        managed_group_config: &ManagedGroupConfig,
        welcome: Welcome,
        ratchet_tree: Option<Vec<Option<Node>>>,
    ) -> Result<Self, ManagedGroupError> {
        let resumption_secret_store =
            ResumptionSecretStore::new(managed_group_config.number_of_resumption_secrets);
        let key_package_bundle = welcome
            .secrets()
            .iter()
            .find_map(|egs| {
                backend
                    .key_store()
                    .read(&egs.key_package_hash.as_slice().to_vec())
            })
            .ok_or(ManagedGroupError::NoMatchingKeyPackageBundle)?;
        // TODO #141
        let group =
            MlsGroup::new_from_welcome(welcome, ratchet_tree, key_package_bundle, None, backend)?;

        let managed_group = ManagedGroup {
            managed_group_config: managed_group_config.clone(),
            group,
            pending_proposals: vec![],
            own_kpbs: vec![],
            aad: vec![],
            resumption_secret_store,
            active: true,
        };

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

        Ok(managed_group)
    }
/// Creates a new group from a `Welcome` message
Creates a new group from a `Welcome` message
Creates a new group from a ` Welcome ` message
pub fn new_from_welcome(
        backend: &impl OpenMlsCryptoProvider,
        managed_group_config: &ManagedGroupConfig,
        welcome: Welcome,
        ratchet_tree: Option<Vec<Option<Node>>>,
    ) -> Result<Self, ManagedGroupError> {
        let resumption_secret_store =
            ResumptionSecretStore::new(managed_group_config.number_of_resumption_secrets);
        let key_package_bundle = welcome
            .secrets()
            .iter()
            .find_map(|egs| {
                backend
                    .key_store()
                    .read(&egs.key_package_hash.as_slice().to_vec())
            })
            .ok_or(ManagedGroupError::NoMatchingKeyPackageBundle)?;
        // TODO #141
        let group =
            MlsGroup::new_from_welcome(welcome, ratchet_tree, key_package_bundle, None, backend)?;
        let managed_group = ManagedGroup {
            managed_group_config: managed_group_config.clone(),
            group,
            pending_proposals: vec![],
            own_kpbs: vec![],
            aad: vec![],
            resumption_secret_store,
            active: true,
        };
        // Since the state of the group was changed, call the auto-save function
        managed_group.auto_save();
        Ok(managed_group)
    }
pub fn new_from_welcome ( backend : & impl OpenMlsCryptoProvider , managed_group_config : & ManagedGroupConfig , welcome : Welcome , ratchet_tree : Option < Vec < Option < Node > > > , ) -> Result < Self , ManagedGroupError > { let resumption_secret_store = ResumptionSecretStore :: new ( managed_group_config . number_of_resumption_secrets ) ; let key_package_bundle = welcome . secrets ( ) . iter ( ) . find_map ( | egs | { backend . key_store ( ) . read ( & egs . key_package_hash . as_slice ( ) . to_vec ( ) ) } ) . ok_or ( ManagedGroupError :: NoMatchingKeyPackageBundle ) ? ; // TODO #141 let group = MlsGroup :: new_from_welcome ( welcome , ratchet_tree , key_package_bundle , None , backend ) ? ; let managed_group = ManagedGroup { managed_group_config : managed_group_config . clone ( ) , group , pending_proposals : vec ! [ ] , own_kpbs : vec ! [ ] , aad : vec ! [ ] , resumption_secret_store , active : true , } ; // Since the state of the group was changed, call the auto-save function managed_group . auto_save ( ) ; Ok ( managed_group ) }
Creates a new group from a `Welcome` message
Creates a new group from a ` Welcome ` message
backend
&impl OpenMlsCryptoProvider
managed_group_config
&ManagedGroupConfig
welcome
Welcome
ratchet_tree
Option<Vec<Option<Node>>>
backend
&impl OpenMlsCryptoProvider
managed_group_config
&ManagedGroupConfig
welcome
Welcome
ratchet_tree
Option<Vec<Option<Node>>>