pub(crate) fn from_leaf_secret(
        backend: &impl OpenMlsCryptoProvider,
        leaf_index: LeafIndex,
        leaf_secret: &Secret,
    ) -> Self {
        // let leaf_secret = key_package_bundle.leaf_secret();
        // let ciphersuite = key_package_bundle.key_package.ciphersuite();
        let leaf_node_secret = derive_leaf_node_secret(leaf_secret, backend);
        let keypair = leaf_secret
            .ciphersuite()
            .derive_hpke_keypair(backend.crypto(), &leaf_node_secret);

        Self {
            leaf_index,
            hpke_private_key: Some(keypair.private.into()),
            path_keys: PathKeys::default(),
            commit_secret: None,
            path_secrets: Vec::default(),
        }
    }
/// Create a minimal `PrivateTree` setting only the private key.
/// This function is used to initialize a `PrivateTree` with a
/// leaf secret. Further secrets like path secrets and keypairs
/// will only be derived in a further step. The HPKE private key is
/// derived from the leaf secret contained in the KeyPackageBundle.
Create a minimal `PrivateTree` setting only the private key.
This function is used to initialize a `PrivateTree` with a
leaf secret. Further secrets like path secrets and keypairs
will only be derived in a further step. The HPKE private key is
derived from the leaf secret contained in the KeyPackageBundle.
Create a minimal ` PrivateTree ` setting only the private key . This function is used to initialize a ` PrivateTree ` with a leaf secret . Further secrets like path secrets and keypairs will only be derived in a further step . The HPKE private key is derived from the leaf secret contained in the KeyPackageBundle .
pub(crate) fn from_leaf_secret(
        backend: &impl OpenMlsCryptoProvider,
        leaf_index: LeafIndex,
        leaf_secret: &Secret,
    ) -> Self {
        // let leaf_secret = key_package_bundle.leaf_secret();
        // let ciphersuite = key_package_bundle.key_package.ciphersuite();
        let leaf_node_secret = derive_leaf_node_secret(leaf_secret, backend);
        let keypair = leaf_secret
            .ciphersuite()
            .derive_hpke_keypair(backend.crypto(), &leaf_node_secret);
        Self {
            leaf_index,
            hpke_private_key: Some(keypair.private.into()),
            path_keys: PathKeys::default(),
            commit_secret: None,
            path_secrets: Vec::default(),
        }
    }
pub ( crate ) fn from_leaf_secret ( backend : & impl OpenMlsCryptoProvider , leaf_index : LeafIndex , leaf_secret : & Secret , ) -> Self { // let leaf_secret = key_package_bundle.leaf_secret(); // let ciphersuite = key_package_bundle.key_package.ciphersuite(); let leaf_node_secret = derive_leaf_node_secret ( leaf_secret , backend ) ; let keypair = leaf_secret . ciphersuite ( ) . derive_hpke_keypair ( backend . crypto ( ) , & leaf_node_secret ) ; Self { leaf_index , hpke_private_key : Some ( keypair . private . into ( ) ) , path_keys : PathKeys :: default ( ) , commit_secret : None , path_secrets : Vec :: default ( ) , } }
Create a minimal `PrivateTree` setting only the private key.
Create a minimal ` PrivateTree ` setting only the private key .
backend
&impl OpenMlsCryptoProvider
leaf_index
LeafIndex
leaf_secret
&Secret
backend
&impl OpenMlsCryptoProvider
leaf_index
LeafIndex
leaf_secret
&Secret