From 2c54b8d77eca0ca5e2ba7c6e4afef67724bef706 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 31 Mar 2020 15:09:14 +0200 Subject: [PATCH] ask the user if the other user scanned the QR code --- src/crypto/verification/QRCode.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/crypto/verification/QRCode.js b/src/crypto/verification/QRCode.js index 1915f9d1c..548910ed5 100644 --- a/src/crypto/verification/QRCode.js +++ b/src/crypto/verification/QRCode.js @@ -49,6 +49,7 @@ export class ReciprocateQRCode extends Base { "with this method yet."); } + // 1. check the secret if (this.startEvent.getContent()['secret'] !== this.request.encodedSharedSecret) { throw newKeyMismatchError(); } @@ -64,6 +65,13 @@ export class ReciprocateQRCode extends Base { const devices = (await this._baseApis.getStoredDevicesForUser(this.userId)) || []; const targetDevice = devices.find(d => { return d.deviceId === this.request.targetDevice.deviceId; + // 2. ask if other user shows shield as well + await new Promise((resolve, reject) => { + this.reciprocateQREvent = { + confirm: resolve, + cancel: reject, // which code should we cancel with here? + }; + this.emit("show_reciprocate_qr", this.reciprocateQREvent); }); if (!targetDevice) throw new Error("Device not found, somehow"); keys[`ed25519:${targetDevice.deviceId}`] = targetDevice.getFingerprint();