Yubico / yubikit-ios

Yubico Mobile iOS SDK - YubiKit
Apache License 2.0
195 stars 43 forks source link

macOS usage? #68

Closed Fonta1n3 closed 3 years ago

Fonta1n3 commented 3 years ago

Ive got this library working great in a Mac catalyst project, however it only seems to work on iPhone and not on a Mac. Any idea why that may be?

dmennis commented 3 years ago

@Fonta1n3 This is a good question. As developers, we all hope the "catalyst" checkbox will makes all our mobile apps and libraries just work on desktop (MacOS). That is true in some cases but the reality always depends on the type of app and what resources are being accessed. The YubiKit for iOS was intended and development is primarily focused on supporting the mobile devices with specific functionality and connections like NFC and Lightning connector to name a few.

This library has not been tested to interact with YubiKeys on MacOS, however, this shouldn't block you from trying. Could you tell us what YubiKey features and protocols your app will be using on MacOS? Also, do any parts of your MacOS catalyst app work?

natikgadzhi commented 3 years ago

I'm also looking into it! I want to be able to grab OTP codes from OATH using a key connected via USB-C. Looks like Mac OS doesn't use the iAP2 spec, and so the accessoryConnection doesn't start if/when the key is plugged in. There's also no NFC reader in a macbook, so that won't work either, right?

UPD: Basically, I was looking to make something like the Yubico Auth for desktop as a learning exercise. Looks like it might be easier to just wrap part of it's C++ code in a Swift library, or try prying the code you need from the deprecated C library.

UDP2: Soo the C++ desktop app looks very much like it's a QT app that wraps around a python script that wraps around ykman.

jensutbult commented 3 years ago

As you already figured out the iOS SDK only supports communicating with the YubiKey using the External Accessory Framework and NFC. Since neither of these are available on MacOS the SDK will not be able to establish a connection to a YubiKey on MacOS. You're also right about the desktop authenticator app being a QT app.

robb-j commented 1 year ago

Hey, with the new CryptoTokenKit library on iPadOS and macOS, could macOS support be revisited?

jensutbult commented 1 year ago

Du to the design of the Objective-C SDK it's difficult adding support for macOS to it without turning the code into a horrible mess of ifdefs. We are however looking into other ways of adding native macOS support for YubiKeys in the future, but we can't promise any release dates as of now.

robb-j commented 1 year ago

Hey, I ended up making my own implementations for LIST and CALCULATE for a Mac app, based on CryptoKit if you’re interested to see what it looks like. https://github.com/robb-j/MiniYubiOath/blob/main/MiniYubiOath/OathStore/SmartCardOathStore.swift