-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Group API to encrypt/decrypt using the leaf-node HPKE keys (#248)
* Adding functionality for a group member to HPKE encrypt a message to another member * formatting * adding a flag "non_domain_separated_hpke_encrypt_decrypt" to gate out the non-domain-separated HPKE encrypt/decrypt for members of a group * implementing safe encrypt/decrypt with context * adding comments * refactoring into helper functionsto avoid duplicating logic * fixing componentoperation * fixing the async build, fixing nostd build, fixing `the trait `FfiType` is not implemented for `HpkeCiphertext`` * fixing various build errors * efficiency refactor of componentoperationlabel * update version number --------- Co-authored-by: Ellen Arteca <[email protected]>
- Loading branch information
Showing
4 changed files
with
404 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::client::MlsError; | ||
use alloc::vec::Vec; | ||
use mls_rs_codec::{MlsEncode, MlsSize}; | ||
|
||
pub type ComponentID = u32; | ||
|
||
#[derive(Clone, Debug, PartialEq, MlsSize, MlsEncode)] | ||
pub struct ComponentOperationLabel<'a> { | ||
label: &'static [u8], | ||
component_id: ComponentID, | ||
context: &'a [u8], | ||
} | ||
|
||
impl<'a> ComponentOperationLabel<'a> { | ||
pub fn new(component_id: u32, context: &'a [u8]) -> Self { | ||
Self { | ||
label: b"MLS 1.0 Application", | ||
component_id, | ||
context, | ||
} | ||
} | ||
|
||
pub fn get_bytes(&self) -> Result<Vec<u8>, MlsError> { | ||
self.mls_encode_to_vec().map_err(Into::into) | ||
} | ||
} |
Oops, something went wrong.