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 .await
.unwrap(); .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(); let content = StartContent::try_from(&content).unwrap();
alice_verification.receive_reciprocation(&content); alice_verification.receive_reciprocation(&content);

View File

@ -271,8 +271,7 @@ impl VerificationRequest {
let state = self.inner.lock().unwrap(); let state = self.inner.lock().unwrap();
if let InnerRequest::Ready(r) = &*state { if let InnerRequest::Ready(r) = &*state {
Ok(Some( let qr_verification = QrVerification::from_scan(
QrVerification::from_scan(
r.store.clone(), r.store.clone(),
r.account.clone(), r.account.clone(),
r.private_cross_signing_identity.clone(), r.private_cross_signing_identity.clone(),
@ -282,8 +281,11 @@ impl VerificationRequest {
data, data,
self.we_started, self.we_started,
) )
.await?, .await?;
))
self.verification_cache.insert_qr(qr_verification.clone());
Ok(Some(qr_verification))
} else { } else {
Ok(None) Ok(None)
} }