diff --git a/src/winhello/WindowsHello.cpp b/src/winhello/WindowsHello.cpp index 99e798c501..0a5f4eef38 100644 --- a/src/winhello/WindowsHello.cpp +++ b/src/winhello/WindowsHello.cpp @@ -64,19 +64,18 @@ namespace array_view(reinterpret_cast(challenge.data()), challenge.size())); return AsyncTask::runAndWaitForFuture([&] { - // The first time this is used a key-pair will be generated using the common name - auto result = - KeyCredentialManager::RequestCreateAsync(s_winHelloKeyName, KeyCredentialCreationOption::FailIfExists) - .get(); - - if (result.Status() == KeyCredentialStatus::CredentialAlreadyExists) { - result = KeyCredentialManager::OpenAsync(s_winHelloKeyName).get(); - } else if (result.Status() != KeyCredentialStatus::Success) { - error = QObject::tr("Failed to create Windows Hello credential."); - return false; - } - try { + // The first time this is used a key-pair will be generated using the common name + auto result = + KeyCredentialManager::RequestCreateAsync(s_winHelloKeyName, KeyCredentialCreationOption::FailIfExists) + .get(); + + if (result.Status() == KeyCredentialStatus::CredentialAlreadyExists) { + result = KeyCredentialManager::OpenAsync(s_winHelloKeyName).get(); + } else if (result.Status() != KeyCredentialStatus::Success) { + error = QObject::tr("Failed to create Windows Hello credential."); + return false; + } const auto signature = result.Credential().RequestSignAsync(challengeBuffer).get(); if (signature.Status() != KeyCredentialStatus::Success) { error = QObject::tr("Failed to sign challenge using Windows Hello.");