Skip to content

Commit

Permalink
Add USB-C support to OATH demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
jensutbult committed Aug 22, 2024
1 parent d0ef22b commit d019c73
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ class CredentialsProvider: NSObject, ObservableObject, YKFManagerDelegate {
override init() {
super.init()
YubiKitManager.shared.delegate = self
YubiKitManager.shared.startAccessoryConnection()
if YubiKitDeviceCapabilities.supportsMFIAccessoryKey {
YubiKitManager.shared.startAccessoryConnection()
}
if YubiKitDeviceCapabilities.supportsSmartCardOverUSBC {
YubiKitManager.shared.startSmartCardConnection()
}
}

var nfcConnection: YKFNFCConnection?
Expand Down Expand Up @@ -51,6 +56,19 @@ class CredentialsProvider: NSObject, ObservableObject, YKFManagerDelegate {
credentials.removeAll()
}

var smartCardConnection: YKFSmartCardConnection?

func didConnectSmartCard(_ connection: YKFSmartCardConnection) {
smartCardConnection = connection
refresh()
}

func didDisconnectSmartCard(_ connection: YKFSmartCardConnection, error: (any Error)?) {
smartCardConnection = nil
session = nil
credentials.removeAll()
}

var connectionCallback: ((_ connection: YKFConnectionProtocol) -> Void)?

func connection(completion: @escaping (_ connection: YKFConnectionProtocol) -> Void) {
Expand Down

0 comments on commit d019c73

Please sign in to comment.