Skip to content

Commit

Permalink
Passkeys: Allow nfc and usb transports
Browse files Browse the repository at this point in the history
  • Loading branch information
varjolintu authored and droidmonkey committed Mar 31, 2024
1 parent 35fdcfa commit d5e6f39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/browser/BrowserPasskeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const QString BrowserPasskeys::AAGUID = QStringLiteral("fdb141b25d84443e8a354698
// Authenticator capabilities
const QString BrowserPasskeys::ATTACHMENT_CROSS_PLATFORM = QStringLiteral("cross-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_USER_VERIFICATION = true;

Expand Down
4 changes: 3 additions & 1 deletion src/browser/BrowserPasskeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class BrowserPasskeys : public QObject

static const QString ATTACHMENT_CROSS_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_USER_VERIFICATION;

Expand Down
6 changes: 4 additions & 2 deletions src/browser/PasskeyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,10 @@ QStringList PasskeyUtils::getAllowedCredentialsFromAssertionOptions(const QJsonO
const auto cred = credential.toObject();
const auto id = cred["id"].toString();
const auto transports = cred["transports"].toArray();
const auto hasSupportedTransport =
transports.isEmpty() || transports.contains(BrowserPasskeys::AUTHENTICATOR_TRANSPORT);
const auto hasSupportedTransport = transports.isEmpty()
|| (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()) {
allowedCredentials << id;
Expand Down

0 comments on commit d5e6f39

Please sign in to comment.