crypto: Store key::verification::start::SasV1Content

… instead of SasV1ContentInit
master
Jonas Platte 2021-06-25 12:04:20 +02:00
parent 52fd551890
commit df71de5af2
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
1 changed files with 7 additions and 11 deletions

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
use std::{ use std::{
convert::TryFrom, convert::{TryFrom, TryInto},
matches, matches,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
time::{Duration, Instant}, time::{Duration, Instant},
@ -222,7 +222,7 @@ impl<S: Clone + std::fmt::Debug> std::fmt::Debug for SasState<S> {
/// The initial SAS state. /// The initial SAS state.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Created { pub struct Created {
protocol_definitions: SasV1ContentInit, protocol_definitions: SasV1Content,
} }
/// The initial SAS state if the other side started the SAS verification. /// The initial SAS state if the other side started the SAS verification.
@ -407,7 +407,9 @@ impl SasState<Created> {
key_agreement_protocols: KEY_AGREEMENT_PROTOCOLS.to_vec(), key_agreement_protocols: KEY_AGREEMENT_PROTOCOLS.to_vec(),
message_authentication_codes: MACS.to_vec(), message_authentication_codes: MACS.to_vec(),
hashes: HASHES.to_vec(), hashes: HASHES.to_vec(),
}, }
.try_into()
.expect("Invalid protocol definition."),
}), }),
} }
} }
@ -417,19 +419,13 @@ impl SasState<Created> {
FlowId::ToDevice(s) => OwnedStartContent::ToDevice(StartToDeviceEventContent::new( FlowId::ToDevice(s) => OwnedStartContent::ToDevice(StartToDeviceEventContent::new(
self.device_id().into(), self.device_id().into(),
s.to_string(), s.to_string(),
StartMethod::SasV1( StartMethod::SasV1(self.state.protocol_definitions.clone()),
SasV1Content::new(self.state.protocol_definitions.clone())
.expect("Invalid initial protocol definitions."),
),
)), )),
FlowId::InRoom(r, e) => OwnedStartContent::Room( FlowId::InRoom(r, e) => OwnedStartContent::Room(
r.clone(), r.clone(),
StartEventContent::new( StartEventContent::new(
self.device_id().into(), self.device_id().into(),
StartMethod::SasV1( StartMethod::SasV1(self.state.protocol_definitions.clone()),
SasV1Content::new(self.state.protocol_definitions.clone())
.expect("Invalid initial protocol definitions."),
),
Relation::new(e.clone()), Relation::new(e.clone()),
), ),
), ),