From 3054e8e6f44c11b5b31b804f7fd42a3548986db6 Mon Sep 17 00:00:00 2001 From: Mingshen Sun Date: Fri, 17 Mar 2023 22:20:50 -0700 Subject: [PATCH] Fix YubiKey feature detection logics --- pass/AppDelegate.swift | 3 --- pass/Controllers/PasswordDetailTableViewController.swift | 2 +- pass/Controllers/SettingsTableViewController.swift | 2 +- passKit/Helpers/YubiKeyConnection.swift | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pass/AppDelegate.swift b/pass/AppDelegate.swift index a65ca6e..4412ada 100644 --- a/pass/AppDelegate.swift +++ b/pass/AppDelegate.swift @@ -35,9 +35,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } } UNUserNotificationCenter.current().delegate = NotificationCenterDispatcher.shared - #if !targetEnvironment(simulator) - _ = passKit.YubiKeyConnection.shared - #endif return true } diff --git a/pass/Controllers/PasswordDetailTableViewController.swift b/pass/Controllers/PasswordDetailTableViewController.swift index 09aae15..88dda63 100644 --- a/pass/Controllers/PasswordDetailTableViewController.swift +++ b/pass/Controllers/PasswordDetailTableViewController.swift @@ -101,7 +101,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni } private func decryptThenShowPassword() { - if Defaults.isYubiKeyEnabled { + if Defaults.isYubiKeyEnabled, YubiKitDeviceCapabilities.supportsISO7816NFCTags { decryptThenShowPasswordYubiKey() } else { decryptThenShowPasswordLocalKey() diff --git a/pass/Controllers/SettingsTableViewController.swift b/pass/Controllers/SettingsTableViewController.swift index 829a2a7..4505e20 100644 --- a/pass/Controllers/SettingsTableViewController.swift +++ b/pass/Controllers/SettingsTableViewController.swift @@ -185,7 +185,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele ) } - if YubiKitDeviceCapabilities.supportsMFIAccessoryKey { + if YubiKitDeviceCapabilities.supportsISO7816NFCTags { optionMenu.addAction( UIAlertAction(title: Defaults.isYubiKeyEnabled ? "✓ YubiKey" : "YubiKey", style: .default) { _ in Defaults.isYubiKeyEnabled.toggle() diff --git a/passKit/Helpers/YubiKeyConnection.swift b/passKit/Helpers/YubiKeyConnection.swift index 1830488..fc8892b 100644 --- a/passKit/Helpers/YubiKeyConnection.swift +++ b/passKit/Helpers/YubiKeyConnection.swift @@ -18,7 +18,7 @@ public class YubiKeyConnection: NSObject { override init() { super.init() - if YubiKitDeviceCapabilities.supportsMFIAccessoryKey { + if YubiKitDeviceCapabilities.supportsISO7816NFCTags { YubiKitManager.shared.delegate = self YubiKitManager.shared.startAccessoryConnection() }