core_crypto_ffi/bundles/
commit.rs1use core_crypto::prelude::MlsCommitBundle;
2#[cfg(target_family = "wasm")]
3use wasm_bindgen::prelude::*;
4
5use crate::{CoreCryptoError, GroupInfoBundle};
6
7#[derive(Debug)]
8#[cfg_attr(
9 target_family = "wasm",
10 wasm_bindgen(getter_with_clone),
11 derive(serde::Serialize, serde::Deserialize)
12)]
13#[cfg_attr(not(target_family = "wasm"), derive(uniffi::Record))]
14pub struct CommitBundle {
15 pub welcome: Option<Vec<u8>>,
16 pub commit: Vec<u8>,
17 pub group_info: GroupInfoBundle,
18}
19
20impl TryFrom<MlsCommitBundle> for CommitBundle {
21 type Error = CoreCryptoError;
22
23 fn try_from(msg: MlsCommitBundle) -> Result<Self, Self::Error> {
24 let (welcome, commit, group_info) = msg.to_bytes_triple()?;
25 let group_info = group_info.into();
26 Ok(Self {
27 welcome,
28 commit,
29 group_info,
30 })
31 }
32}