mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
fix more tests
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//! Verified contact protocol implementation as [specified by countermitm project](https://countermitm.readthedocs.io/en/stable/new.html#setup-contact-protocol)
|
||||
|
||||
use async_std::prelude::*;
|
||||
use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
|
||||
|
||||
use crate::aheader::EncryptPreference;
|
||||
@@ -181,6 +182,21 @@ async fn cleanup(
|
||||
/// Take a scanned QR-code and do the setup-contact/join-group handshake.
|
||||
/// See the ffi-documentation for more details.
|
||||
pub async fn dc_join_securejoin(context: &Context, qr: &str) -> ChatId {
|
||||
use futures::future::FutureExt;
|
||||
|
||||
let cancel = match context.alloc_ongoing().await {
|
||||
Ok(cancel) => cancel,
|
||||
Err(_) => {
|
||||
return cleanup(&context, ChatId::new(0), false, false).await;
|
||||
}
|
||||
};
|
||||
|
||||
securejoin(context, qr)
|
||||
.race(cancel.recv().map(|_| ChatId::new(0)))
|
||||
.await
|
||||
}
|
||||
|
||||
async fn securejoin(context: &Context, qr: &str) -> ChatId {
|
||||
/*========================================================
|
||||
==== Bob - the joiner's side =====
|
||||
==== Step 2 in "Setup verified contact" protocol =====
|
||||
@@ -191,9 +207,6 @@ pub async fn dc_join_securejoin(context: &Context, qr: &str) -> ChatId {
|
||||
|
||||
info!(context, "Requesting secure-join ...",);
|
||||
ensure_secret_key_exists(context).await.ok();
|
||||
if !context.alloc_ongoing().await {
|
||||
return cleanup(&context, contact_chat_id, false, join_vg).await;
|
||||
}
|
||||
let qr_scan = check_qr(context, &qr).await;
|
||||
if qr_scan.state != LotState::QrAskVerifyContact && qr_scan.state != LotState::QrAskVerifyGroup
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user