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