From e31bc85135d54d8a03f88f6c7395958b20acc336 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Fri, 10 May 2024 19:05:52 -0400 Subject: [PATCH] changes --- openmls/src/group/mls_group/mod.rs | 5 +++-- openmls/src/lib.rs | 6 +++--- openmls/src/storage.rs | 12 ++++++++++-- traits/src/storage.rs | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/openmls/src/group/mls_group/mod.rs b/openmls/src/group/mls_group/mod.rs index 15031a873..28ea35d27 100644 --- a/openmls/src/group/mls_group/mod.rs +++ b/openmls/src/group/mls_group/mod.rs @@ -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; @@ -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 === diff --git a/openmls/src/lib.rs b/openmls/src/lib.rs index e12ebb36d..1436ca22b 100644 --- a/openmls/src/lib.rs +++ b/openmls/src/lib.rs @@ -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", diff --git a/openmls/src/storage.rs b/openmls/src/storage.rs index 86b07e713..a67f3c9f2 100644 --- a/openmls/src/storage.rs +++ b/openmls/src/storage.rs @@ -61,8 +61,16 @@ pub struct ByteWrapper { data: Vec, } -impl ByteWrapper { - pub fn from(data: Vec) -> Self { +impl From<&[u8]> for ByteWrapper { + fn from(bytes: &[u8]) -> ByteWrapper { + ByteWrapper { + data: bytes.to_vec(), + } + } +} + +impl From> for ByteWrapper { + fn from(data: Vec) -> ByteWrapper { ByteWrapper { data } } } diff --git a/traits/src/storage.rs b/traits/src/storage.rs index eef0fa748..6b2fad076 100644 --- a/traits/src/storage.rs +++ b/traits/src/storage.rs @@ -276,10 +276,10 @@ pub trait StorageProvider { /// Returns the AAD for the group with given id /// If the value has not been set, returns an empty vector. - fn aad, ByteWrapper: traits::ByteWrapper>( + fn aad>( &self, group_id: &GroupId, - ) -> Result; + ) -> Result, 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<