core_crypto/mls/
proposal.rs1use crate::mls::ClientId;
2use openmls::prelude::{KeyPackage, hash_ref::ProposalRef};
3
4#[derive(Debug, Clone, Eq, PartialEq, derive_more::From, derive_more::Deref, derive_more::Display)]
6pub struct MlsProposalRef(ProposalRef);
7
8impl From<Vec<u8>> for MlsProposalRef {
9 fn from(value: Vec<u8>) -> Self {
10 Self(ProposalRef::from_slice(value.as_slice()))
11 }
12}
13
14impl MlsProposalRef {
15 pub fn into_inner(self) -> ProposalRef {
17 self.0
18 }
19
20 pub(crate) fn to_bytes(&self) -> Vec<u8> {
21 self.0.as_slice().to_vec()
22 }
23}
24
25#[cfg(test)]
26impl From<MlsProposalRef> for Vec<u8> {
27 fn from(prop_ref: MlsProposalRef) -> Self {
28 prop_ref.0.as_slice().to_vec()
29 }
30}
31
32#[allow(clippy::large_enum_variant)]
37pub enum MlsProposal {
38 Add(KeyPackage),
40 Update,
43 Remove(ClientId),
45}