Check login intents match between QR code and current flow

This commit is contained in:
Stefan Ceriu
2022-10-13 11:33:18 +03:00
committed by Stefan Ceriu
parent d422e3ea1d
commit 68461d5fd5
2 changed files with 3 additions and 3 deletions
@@ -169,7 +169,8 @@ class QRLoginService: NSObject, QRLoginServiceProtocol {
MXLog.debug("[QRLoginService] processQRLoginCode: \(code)")
state = .connectingToDevice
guard let uri = code.rendezvous.transport?.uri,
guard code.intent == QRLoginRendezvousPayload.Intent.loginReciprocate.rawValue,
let uri = code.rendezvous.transport?.uri,
let rendezvousURL = URL(string: uri),
let key = code.rendezvous.key else {
MXLog.debug("[QRLoginService] QR code invalid")
@@ -190,8 +191,6 @@ class QRLoginService: NSObject, QRLoginServiceProtocol {
state = .waitingForConfirmation(validationCode)
// TODO: check compatibility of intents
MXLog.debug("[QRLoginService] Waiting for available protocols")
guard case let .success(data) = await rendezvousService.receive(),
let responsePayload = try? JSONDecoder().decode(QRLoginRendezvousPayload.self, from: data) else {