From df71de5af24fb08477801445042d0cdd55020012 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 25 Jun 2021 12:04:20 +0200 Subject: [PATCH] crypto: Store key::verification::start::SasV1Content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … instead of SasV1ContentInit --- .../src/verification/sas/sas_state.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/matrix_sdk_crypto/src/verification/sas/sas_state.rs b/matrix_sdk_crypto/src/verification/sas/sas_state.rs index 2c63bbc3..2ab1beb6 100644 --- a/matrix_sdk_crypto/src/verification/sas/sas_state.rs +++ b/matrix_sdk_crypto/src/verification/sas/sas_state.rs @@ -13,7 +13,7 @@ // limitations under the License. use std::{ - convert::TryFrom, + convert::{TryFrom, TryInto}, matches, sync::{Arc, Mutex}, time::{Duration, Instant}, @@ -222,7 +222,7 @@ impl std::fmt::Debug for SasState { /// The initial SAS state. #[derive(Clone, Debug)] pub struct Created { - protocol_definitions: SasV1ContentInit, + protocol_definitions: SasV1Content, } /// The initial SAS state if the other side started the SAS verification. @@ -407,7 +407,9 @@ impl SasState { key_agreement_protocols: KEY_AGREEMENT_PROTOCOLS.to_vec(), message_authentication_codes: MACS.to_vec(), hashes: HASHES.to_vec(), - }, + } + .try_into() + .expect("Invalid protocol definition."), }), } } @@ -417,19 +419,13 @@ impl SasState { FlowId::ToDevice(s) => OwnedStartContent::ToDevice(StartToDeviceEventContent::new( self.device_id().into(), s.to_string(), - StartMethod::SasV1( - SasV1Content::new(self.state.protocol_definitions.clone()) - .expect("Invalid initial protocol definitions."), - ), + StartMethod::SasV1(self.state.protocol_definitions.clone()), )), FlowId::InRoom(r, e) => OwnedStartContent::Room( r.clone(), StartEventContent::new( self.device_id().into(), - StartMethod::SasV1( - SasV1Content::new(self.state.protocol_definitions.clone()) - .expect("Invalid initial protocol definitions."), - ), + StartMethod::SasV1(self.state.protocol_definitions.clone()), Relation::new(e.clone()), ), ),