fn replace_private_tree_path_(
        &mut self,
        backend: &impl OpenMlsCryptoProvider,
        leaf_secret: &Secret,
        group_context: &[u8],
        new_leaves_indexes_option: Option<HashSet<&LeafIndex>>,
    ) -> Option<Vec<UpdatePathNode>> {
        // Compute the direct path and keypairs along it
        let own_index = self.own_node_index();
        let direct_path_root = treemath::leaf_direct_path(own_index, self.leaf_count())
            .expect("replace_private_tree: Error when computing direct path.");
        // Update private tree and merge corresponding public keys.
        let (private_tree, new_public_keys) = PrivateTree::new_with_keys(
            self.ciphersuite,
            backend,
            own_index,
            leaf_secret,
            &direct_path_root,
        );
        self.private_tree = private_tree;

        self.merge_public_keys(&new_public_keys, &direct_path_root)
            .unwrap();

        self.set_parent_hashes(backend, own_index);
        if let Some(new_leaves_indexes) = new_leaves_indexes_option {
            let update_path_nodes = self
                .encrypt_to_copath(
                    backend.crypto(),
                    new_public_keys,
                    group_context,
                    new_leaves_indexes,
                )
                .unwrap();
            Some(update_path_nodes)
        } else {
            None
        }
    }
/// Replace the private tree with a new one based on the
/// `leaf_secret` only.
Replace the private tree with a new one based on the
`leaf_secret` only.
Replace the private tree with a new one based on the ` leaf_secret ` only .
fn replace_private_tree_path_(
        &mut self,
        backend: &impl OpenMlsCryptoProvider,
        leaf_secret: &Secret,
        group_context: &[u8],
        new_leaves_indexes_option: Option<HashSet<&LeafIndex>>,
    ) -> Option<Vec<UpdatePathNode>> {
        // Compute the direct path and keypairs along it
        let own_index = self.own_node_index();
        let direct_path_root = treemath::leaf_direct_path(own_index, self.leaf_count())
            .expect("replace_private_tree: Error when computing direct path.");
        // Update private tree and merge corresponding public keys.
        let (private_tree, new_public_keys) = PrivateTree::new_with_keys(
            self.ciphersuite,
            backend,
            own_index,
            leaf_secret,
            &direct_path_root,
        );
        self.private_tree = private_tree;
        self.merge_public_keys(&new_public_keys, &direct_path_root)
            .unwrap();
        self.set_parent_hashes(backend, own_index);
        if let Some(new_leaves_indexes) = new_leaves_indexes_option {
            let update_path_nodes = self
                .encrypt_to_copath(
                    backend.crypto(),
                    new_public_keys,
                    group_context,
                    new_leaves_indexes,
                )
                .unwrap();
            Some(update_path_nodes)
        } else {
            None
        }
    }
fn replace_private_tree_path_ ( & mut self , backend : & impl OpenMlsCryptoProvider , leaf_secret : & Secret , group_context : & [ u8 ] , new_leaves_indexes_option : Option < HashSet < & LeafIndex > > , ) -> Option < Vec < UpdatePathNode > > { // Compute the direct path and keypairs along it let own_index = self . own_node_index ( ) ; let direct_path_root = treemath :: leaf_direct_path ( own_index , self . leaf_count ( ) ) . expect ( " " ) ; // Update private tree and merge corresponding public keys. let ( private_tree , new_public_keys ) = PrivateTree :: new_with_keys ( self . ciphersuite , backend , own_index , leaf_secret , & direct_path_root , ) ; self . private_tree = private_tree ; self . merge_public_keys ( & new_public_keys , & direct_path_root ) . unwrap ( ) ; self . set_parent_hashes ( backend , own_index ) ; if let Some ( new_leaves_indexes ) = new_leaves_indexes_option { let update_path_nodes = self . encrypt_to_copath ( backend . crypto ( ) , new_public_keys , group_context , new_leaves_indexes , ) . unwrap ( ) ; Some ( update_path_nodes ) } else { None } }
Replace the private tree with a new one based on the
`leaf_secret` only.
Replace the private tree with a new one based on the ` leaf_secret ` only .
&mut self
backend
&impl OpenMlsCryptoProvider
leaf_secret
&Secret
group_context
&[u8]
new_leaves_indexes_option
Option<HashSet<&LeafIndex>>
&mut self
backend
&impl OpenMlsCryptoProvider
leaf_secret
&Secret
group_context
&[u8]
new_leaves_indexes_option
Option<HashSet<&LeafIndex>>