From cdaf60da73d148eb37c81ce1efd257c237c74acd Mon Sep 17 00:00:00 2001 From: Mingshen Sun Date: Sun, 12 Mar 2023 14:46:37 -0700 Subject: [PATCH] Do not init Yubikey if device does not support MFI accessory --- passKit/Helpers/YubiKeyConnection.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/passKit/Helpers/YubiKeyConnection.swift b/passKit/Helpers/YubiKeyConnection.swift index 4d8c758..1830488 100644 --- a/passKit/Helpers/YubiKeyConnection.swift +++ b/passKit/Helpers/YubiKeyConnection.swift @@ -18,8 +18,10 @@ public class YubiKeyConnection: NSObject { override init() { super.init() - YubiKitManager.shared.delegate = self - YubiKitManager.shared.startAccessoryConnection() + if YubiKitDeviceCapabilities.supportsMFIAccessoryKey { + YubiKitManager.shared.delegate = self + YubiKitManager.shared.startAccessoryConnection() + } } public func connection(cancellation: @escaping (_ error: Error) -> Void, completion: @escaping (_ connection: YKFConnectionProtocol) -> Void) {