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 schedule::{
7 pprf::{Pprf, PprfError, Prefix16},
8 ApplicationExportSecret,
9 },
10};
11
12pub(crate) type ApplicationExportTree = Pprf<Prefix16>;
13
14pub type ApplicationExportTreeError = PprfError;
17
18impl ApplicationExportTree {
19 pub(crate) fn new(application_exporter: ApplicationExportSecret) -> Self {
20 let size = TreeSize::from_leaf_count(u16::MAX as u32);
21 Pprf::new_with_size(application_exporter.secret, size)
22 }
23
24 pub(crate) fn safe_export_secret(
25 &mut self,
26 crypto: &impl OpenMlsCrypto,
27 ciphersuite: Ciphersuite,
28 component_id: u16,
29 ) -> Result<Secret, ApplicationExportTreeError> {
30 self.evaluate(crypto, ciphersuite, &component_id)
31 }
32}