Passkeys: Allow nfc and usb transports

This commit is contained in:
varjolintu 2024-03-12 17:20:56 +02:00 committed by Jonathan White
parent 35fdcfa28d
commit d5e6f394b7
3 changed files with 10 additions and 4 deletions

View File

@ -43,7 +43,9 @@ const QString BrowserPasskeys::AAGUID = QStringLiteral("fdb141b25d84443e8a354698
// Authenticator capabilities // Authenticator capabilities
const QString BrowserPasskeys::ATTACHMENT_CROSS_PLATFORM = QStringLiteral("cross-platform"); const QString BrowserPasskeys::ATTACHMENT_CROSS_PLATFORM = QStringLiteral("cross-platform");
const QString BrowserPasskeys::ATTACHMENT_PLATFORM = QStringLiteral("platform"); const QString BrowserPasskeys::ATTACHMENT_PLATFORM = QStringLiteral("platform");
const QString BrowserPasskeys::AUTHENTICATOR_TRANSPORT = QStringLiteral("internal"); const QString BrowserPasskeys::AUTHENTICATOR_TRANSPORT_INTERNAL = QStringLiteral("internal");
const QString BrowserPasskeys::AUTHENTICATOR_TRANSPORT_NFC = QStringLiteral("nfc");
const QString BrowserPasskeys::AUTHENTICATOR_TRANSPORT_USB = QStringLiteral("usb");
const bool BrowserPasskeys::SUPPORT_RESIDENT_KEYS = true; const bool BrowserPasskeys::SUPPORT_RESIDENT_KEYS = true;
const bool BrowserPasskeys::SUPPORT_USER_VERIFICATION = true; const bool BrowserPasskeys::SUPPORT_USER_VERIFICATION = true;

View File

@ -91,7 +91,9 @@ public:
static const QString ATTACHMENT_CROSS_PLATFORM; static const QString ATTACHMENT_CROSS_PLATFORM;
static const QString ATTACHMENT_PLATFORM; static const QString ATTACHMENT_PLATFORM;
static const QString AUTHENTICATOR_TRANSPORT; static const QString AUTHENTICATOR_TRANSPORT_INTERNAL;
static const QString AUTHENTICATOR_TRANSPORT_NFC;
static const QString AUTHENTICATOR_TRANSPORT_USB;
static const bool SUPPORT_RESIDENT_KEYS; static const bool SUPPORT_RESIDENT_KEYS;
static const bool SUPPORT_USER_VERIFICATION; static const bool SUPPORT_USER_VERIFICATION;

View File

@ -340,8 +340,10 @@ QStringList PasskeyUtils::getAllowedCredentialsFromAssertionOptions(const QJsonO
const auto cred = credential.toObject(); const auto cred = credential.toObject();
const auto id = cred["id"].toString(); const auto id = cred["id"].toString();
const auto transports = cred["transports"].toArray(); const auto transports = cred["transports"].toArray();
const auto hasSupportedTransport = const auto hasSupportedTransport = transports.isEmpty()
transports.isEmpty() || transports.contains(BrowserPasskeys::AUTHENTICATOR_TRANSPORT); || (transports.contains(BrowserPasskeys::AUTHENTICATOR_TRANSPORT_INTERNAL)
|| transports.contains(BrowserPasskeys::AUTHENTICATOR_TRANSPORT_NFC)
|| transports.contains(BrowserPasskeys::AUTHENTICATOR_TRANSPORT_USB));
if (cred["type"].toString() == BrowserPasskeys::PUBLIC_KEY && hasSupportedTransport && !id.isEmpty()) { if (cred["type"].toString() == BrowserPasskeys::PUBLIC_KEY && hasSupportedTransport && !id.isEmpty()) {
allowedCredentials << id; allowedCredentials << id;