crypto: Allow users to check the SAS even after a mac event was received.

master
Damir Jelić 2020-07-23 14:35:29 +02:00
parent 2729f01e0f
commit ee51ed78be
1 changed files with 21 additions and 1 deletions

View File

@ -260,6 +260,7 @@ impl Sas<KeyReceived> {
verification_flow_id: self.verification_flow_id, verification_flow_id: self.verification_flow_id,
ids: self.ids, ids: self.ids,
state: MacReceived { state: MacReceived {
we_started: self.state.we_started,
verified_devices: devices, verified_devices: devices,
verified_master_keys: master_keys, verified_master_keys: master_keys,
}, },
@ -305,6 +306,7 @@ impl Sas<Confirmed> {
} }
struct MacReceived { struct MacReceived {
we_started: bool,
verified_devices: Vec<Box<DeviceId>>, verified_devices: Vec<Box<DeviceId>>,
verified_master_keys: Vec<String>, verified_master_keys: Vec<String>,
} }
@ -321,6 +323,24 @@ impl Sas<MacReceived> {
}, },
} }
} }
fn get_emoji(&self) -> Vec<(&'static str, &'static str)> {
get_emoji(
&self.inner,
&self.ids,
&self.verification_flow_id,
self.state.we_started,
)
}
fn get_decimal(&self) -> (u32, u32, u32) {
get_decimal(
&self.inner,
&self.ids,
&self.verification_flow_id,
self.state.we_started,
)
}
} }
struct Done { struct Done {
@ -448,7 +468,7 @@ mod test {
let event = wrap_to_device_event(bob.user_id(), bob.get_mac_event_content()); let event = wrap_to_device_event(bob.user_id(), bob.get_mac_event_content());
let alice = alice.into_mac_received(&event); let alice = alice.into_mac_received(&event);
// assert!(!alice.get_emoji().is_empty()); assert!(!alice.get_emoji().is_empty());
let alice = alice.confirm(); let alice = alice.confirm();
let event = wrap_to_device_event(alice.user_id(), alice.get_mac_event_content()); let event = wrap_to_device_event(alice.user_id(), alice.get_mac_event_content());