From 82bb5b15ad2502179fccdef33bc6aa2e65a02b67 Mon Sep 17 00:00:00 2001 From: Ethan Mateja Date: Wed, 20 Mar 2024 16:32:22 -0700 Subject: [PATCH] Resolve errors in identity.rs --- xmtp_mls/src/identity.rs | 7 +++---- xmtp_mls/src/verified_key_package.rs | 9 +++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xmtp_mls/src/identity.rs b/xmtp_mls/src/identity.rs index ca7bed2e7..4f931ce9d 100644 --- a/xmtp_mls/src/identity.rs +++ b/xmtp_mls/src/identity.rs @@ -7,7 +7,7 @@ use openmls::{ prelude::{ Capabilities, Credential as OpenMlsCredential, CredentialType, CredentialWithKey, CryptoConfig, Extension, ExtensionType, Extensions, KeyPackage, KeyPackageNewError, - Lifetime, + Lifetime, tls_codec::Serialize, }, versions::ProtocolVersion, }; @@ -15,7 +15,6 @@ use openmls_basic_credential::SignatureKeyPair; use openmls_traits::{types::CryptoError, OpenMlsProvider}; use prost::Message; use thiserror::Error; -use openmls::prelude::tls_codec::Serialize; use xmtp_cryptography::signature::SignatureError; use xmtp_proto::{ api_client::XmtpMlsClient, xmtp::mls::message_contents::MlsCredential as CredentialProto, @@ -99,7 +98,7 @@ impl Identity { Credential::create_from_legacy(&signature_keys, legacy_signed_private_key)?; let credential_proto: CredentialProto = credential.into(); let mls_credential = - OpenMlsCredential::new(credential_proto.encode_to_vec(), CredentialType::Basic)?; + OpenMlsCredential::new(CredentialType::Basic, credential_proto.encode_to_vec()); info!("Successfully created identity from legacy key"); Ok(Self { account_address, @@ -137,7 +136,7 @@ impl Identity { )? .into(); let credential = - OpenMlsCredential::new(credential_proto.encode_to_vec(), CredentialType::Basic)?; + OpenMlsCredential::new(CredentialType::Basic, credential_proto.encode_to_vec()); self.set_credential(credential)?; } diff --git a/xmtp_mls/src/verified_key_package.rs b/xmtp_mls/src/verified_key_package.rs index 895d72f97..f3500359a 100644 --- a/xmtp_mls/src/verified_key_package.rs +++ b/xmtp_mls/src/verified_key_package.rs @@ -1,7 +1,12 @@ -use openmls::prelude::{KeyPackage, KeyPackageIn, KeyPackageVerifyError}; +use openmls::prelude::{ + KeyPackage, KeyPackageIn, KeyPackageVerifyError, + tls_codec::{ + Deserialize, Error as TlsSerializationError + }, + }; + use openmls_rust_crypto::RustCrypto; use thiserror::Error; -use openmls::prelude::tls_codec::{Deserialize, Error as TlsSerializationError}; use crate::{ configuration::MLS_PROTOCOL_VERSION,