Skip to content

Commit

Permalink
[Bugfix] Derive external pub extension from the new and not old key s…
Browse files Browse the repository at this point in the history
…chedule
  • Loading branch information
Marta Mularczyk committed Mar 8, 2024
1 parent 7b1a4d0 commit 658fd7e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mls-rs/src/group/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ where
let mut extensions = ExtensionList::new();

extensions.set_from({
self.key_schedule
key_schedule_result
.key_schedule
.get_external_key_pair_ext(&self.cipher_suite_provider)
.await?
})?;
Expand Down
29 changes: 29 additions & 0 deletions mls-rs/tests/client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use mls_rs::error::MlsError;
use mls_rs::group::proposal::Proposal;
use mls_rs::group::ReceivedMessage;
use mls_rs::identity::SigningIdentity;
use mls_rs::mls_rules::CommitOptions;
use mls_rs::ExtensionList;
use mls_rs::MlsMessage;
use mls_rs::ProtocolVersion;
Expand Down Expand Up @@ -815,3 +816,31 @@ async fn fake_key_package(id: usize) -> MlsMessage {
.await
.unwrap()
}

#[maybe_async::test(not(mls_build_async), async(mls_build_async, futures_test))]
async fn external_info_from_commit_allows_to_join() {
let cs = CipherSuite::CURVE25519_AES128;
let version = ProtocolVersion::MLS_10;

let mut alice = mls_rs::test_utils::get_test_groups(
version,
cs,
1,
Some(CommitOptions::new().with_allow_external_commit(true)),
false,
&TestCryptoProvider::default(),
)
.await
.remove(0);

let commit = alice.commit(vec![]).await.unwrap();
alice.apply_pending_commit().await.unwrap();
let bob = generate_client(cs, version, 0xdead, false).await;

let (_bob, commit) = bob
.commit_external(commit.external_commit_group_info.unwrap())
.await
.unwrap();

alice.process_incoming_message(commit).await.unwrap();
}

0 comments on commit 658fd7e

Please sign in to comment.