Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed May 10, 2024
1 parent 25e4935 commit e31bc85
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions openmls/src/group/mls_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ use crate::{
key_packages::{KeyPackage, KeyPackageBundle},
messages::proposals::*,
schedule::ResumptionPskSecret,
storage::ByteWrapper,
storage::{OpenMlsProvider, StorageProvider},
treesync::{node::leaf_node::LeafNode, RatchetTree},
};
use openmls_traits::{storage::traits::ByteWrapper, types::Ciphersuite};
use openmls_traits::{storage::traits::ByteWrapper as _, types::Ciphersuite};

// Private
mod application;
Expand Down Expand Up @@ -199,7 +200,7 @@ impl MlsGroup {
aad: &[u8],
) -> Result<(), Storage::Error> {
self.aad = aad.to_vec();
storage.write_aad(self.group_id(), aad)
storage.write_aad(self.group_id(), &ByteWrapper::from(aad))
}

// === Advanced functions ===
Expand Down
6 changes: 3 additions & 3 deletions openmls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@
//! [user Manual]: https://openmls.tech/book
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(not(test), forbid(unsafe_code))]
#![cfg_attr(not(feature = "test-utils"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
// #![cfg_attr(not(feature = "test-utils"), deny(missing_docs))]
// #![deny(rustdoc::broken_intra_doc_links)]
// #![deny(rustdoc::private_intra_doc_links)]
#![cfg(any(
target_pointer_width = "32",
target_pointer_width = "64",
Expand Down
12 changes: 10 additions & 2 deletions openmls/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ pub struct ByteWrapper {
data: Vec<u8>,
}

impl ByteWrapper {
pub fn from(data: Vec<u8>) -> Self {
impl From<&[u8]> for ByteWrapper {
fn from(bytes: &[u8]) -> ByteWrapper {
ByteWrapper {
data: bytes.to_vec(),
}
}
}

impl From<Vec<u8>> for ByteWrapper {
fn from(data: Vec<u8>) -> ByteWrapper {
ByteWrapper { data }
}
}
Expand Down
4 changes: 2 additions & 2 deletions traits/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ pub trait StorageProvider<const VERSION: u16> {

/// Returns the AAD for the group with given id
/// If the value has not been set, returns an empty vector.
fn aad<GroupId: traits::GroupId<VERSION>, ByteWrapper: traits::ByteWrapper<VERSION>>(
fn aad<GroupId: traits::GroupId<VERSION>>(
&self,
group_id: &GroupId,
) -> Result<ByteWrapper, Self::Error>;
) -> Result<impl crate::storage::traits::ByteWrapper<CURRENT_VERSION>, Self::Error>;

/// Returns references of all queued proposals for the group with group id `group_id`, or an empty vector of none are stored.
fn queued_proposal_refs<
Expand Down

0 comments on commit e31bc85

Please sign in to comment.