Skip to content

Commit

Permalink
Remove Developement Use of “Expect”
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieobject committed Apr 10, 2024
1 parent 94f5e81 commit a6fe203
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions xmtp_mls/src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ pub mod validated_commit;

use intents::SendMessageIntentData;
use openmls::{
credentials::BasicCredential,
extensions::{Extension, Extensions, Metadata},
group::{MlsGroupCreateConfig, MlsGroupJoinConfig},
prelude::{
credentials::BasicCredential, error::LibraryError, extensions::{Extension, Extensions, Metadata}, group::{MlsGroupCreateConfig, MlsGroupJoinConfig}, prelude::{
BasicCredentialError, CredentialWithKey, CryptoConfig, Error as TlsCodecError, GroupId,
MlsGroup as OpenMlsGroup, StagedWelcome, Welcome as MlsWelcome, WireFormatPolicy,
},
}
};
use openmls_traits::OpenMlsProvider;
use prost::Message;
Expand Down Expand Up @@ -121,6 +118,8 @@ pub enum GroupError {
EncodeError(#[from] prost::EncodeError),
#[error("Credential error")]
CredentialError(#[from] BasicCredentialError),
#[error("LeafNode error")]
LeafNodeError(#[from] LibraryError),
}

impl RetryableError for GroupError {
Expand Down Expand Up @@ -252,22 +251,16 @@ where

let welcome = deserialize_welcome(&welcome_bytes)?;

// === Create Staged Welcome ===
// Note: .expect will be cleaned up before exiting DRAFT
let join_config = build_group_join_config();
let staged_welcome = StagedWelcome::new_from_welcome(
provider,
&join_config,
welcome.clone(),
None
)
.expect("error created staged mls group");
)?;

// === Obtain address of welcome sender ===
// Note: .expect will be cleaned up before exiting DRAFT
let added_by_node = staged_welcome
.welcome_sender()
.expect("couldn't determine the sender of welcome");
.welcome_sender()?;

let added_by_credential = BasicCredential::try_from(added_by_node.credential())?;
let pub_key_bytes = added_by_node.signature_key().as_slice();
Expand Down

0 comments on commit a6fe203

Please sign in to comment.