core_crypto_ffi/bundles/
proposal.rs

1use core_crypto::prelude::MlsProposalBundle;
2#[cfg(target_family = "wasm")]
3use wasm_bindgen::prelude::*;
4
5use crate::CoreCryptoError;
6
7#[derive(Debug, Clone)]
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 ProposalBundle {
15    /// TLS-serialized MLS proposal that needs to be fanned out to other (existing) members of the conversation
16    pub proposal: Vec<u8>,
17    /// Unique identifier of a proposal.
18    pub proposal_ref: Vec<u8>,
19    /// New CRL Distribution of members of this group
20    pub crl_new_distribution_points: Option<Vec<String>>,
21}
22
23impl TryFrom<MlsProposalBundle> for ProposalBundle {
24    type Error = CoreCryptoError;
25
26    fn try_from(msg: MlsProposalBundle) -> Result<Self, Self::Error> {
27        let (proposal, proposal_ref, crl_new_distribution_points) = msg.to_bytes()?;
28        let crl_new_distribution_points = crl_new_distribution_points.into();
29        Ok(Self {
30            proposal,
31            proposal_ref,
32            crl_new_distribution_points,
33        })
34    }
35}