mls_rs/group/
component_operation.rs

1use crate::client::MlsError;
2use alloc::vec::Vec;
3use mls_rs_codec::{MlsEncode, MlsSize};
4
5pub type ComponentID = u32;
6
7#[derive(Clone, Debug, PartialEq, MlsSize, MlsEncode)]
8pub struct ComponentOperationLabel<'a> {
9    label: &'static [u8],
10    component_id: ComponentID,
11    context: &'a [u8],
12}
13
14impl<'a> ComponentOperationLabel<'a> {
15    pub fn new(component_id: u32, context: &'a [u8]) -> Self {
16        Self {
17            label: b"MLS 1.0 Application",
18            component_id,
19            context,
20        }
21    }
22
23    pub fn get_bytes(&self) -> Result<Vec<u8>, MlsError> {
24        self.mls_encode_to_vec().map_err(Into::into)
25    }
26}