crypto: Add the verification to the cache after we scan a QR code

master
Damir Jelić 2021-07-09 11:40:21 +02:00
parent 5c9840daf8
commit 76d57baa11
2 changed files with 17 additions and 14 deletions

View File

@ -947,7 +947,8 @@ mod test {
.await
.unwrap();
let content = bob_verification.reciprocate().unwrap();
let request = bob_verification.reciprocate().unwrap();
let content = OutgoingContent::from(request);
let content = StartContent::try_from(&content).unwrap();
alice_verification.receive_reciprocation(&content);

View File

@ -271,19 +271,21 @@ impl VerificationRequest {
let state = self.inner.lock().unwrap();
if let InnerRequest::Ready(r) = &*state {
Ok(Some(
QrVerification::from_scan(
r.store.clone(),
r.account.clone(),
r.private_cross_signing_identity.clone(),
r.other_user_id.clone(),
r.state.other_device_id.clone(),
r.flow_id.as_ref().to_owned(),
data,
self.we_started,
)
.await?,
))
let qr_verification = QrVerification::from_scan(
r.store.clone(),
r.account.clone(),
r.private_cross_signing_identity.clone(),
r.other_user_id.clone(),
r.state.other_device_id.clone(),
r.flow_id.as_ref().to_owned(),
data,
self.we_started,
)
.await?;
self.verification_cache.insert_qr(qr_verification.clone());
Ok(Some(qr_verification))
} else {
Ok(None)
}