openmls/schedule/
application_export_tree.rs1use openmls_traits::{crypto::OpenMlsCrypto, types::Ciphersuite};
2
3use crate::{
4 binary_tree::array_representation::TreeSize,
5 ciphersuite::Secret,
6 component::ComponentId,
7 schedule::{
8 pprf::{Pprf, PprfError, Prefix16},
9 ApplicationExportSecret,
10 },
11};
12
13pub(crate) type ApplicationExportTree = Pprf<Prefix16>;
14
15pub type ApplicationExportTreeError = PprfError;
18
19impl ApplicationExportTree {
20 pub(crate) fn new(application_exporter: ApplicationExportSecret) -> Self {
21 let size = TreeSize::from_leaf_count(u16::MAX as u32);
22 Pprf::new_with_size(application_exporter.secret, size)
23 }
24
25 pub(crate) fn safe_export_secret(
26 &mut self,
27 crypto: &impl OpenMlsCrypto,
28 ciphersuite: Ciphersuite,
29 component_id: ComponentId,
30 ) -> Result<Secret, ApplicationExportTreeError> {
31 self.evaluate(crypto, ciphersuite, &component_id)
32 }
33}