Check for Touch ID with the lid closed and a Magic Keyboard with Touch ID

Hey all 👋🏼

Is there any API change required for supporting the Touch ID sensor of an external Magic Keyboard with Touch ID (on a Mac with Apple silicon)?

Currently we rely on canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics for checking if TouchID is present on a system, but this seems to be returning false when the laptop is closed/clamshell mode even with the Magic Keyboard with Touch ID connected to it.

Any suggestions?

The code snippet that we use for checking is:

int isTouchIDAvailable() {
    int result = 0;
    bool success = [[[LAContext alloc] init] canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil];
    if (success) {
        return 1;
    }

    return 0;
}

when the laptop is closed/clamshell mode even with the Magic Keyboard with Touch ID connected to it.

Does Touch ID work for OS-level functionality in this configuration? For example, can you unlock System Preferences > Security & Privacy?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Quinn, thanks for the reply!

Yes, Touch ID from the keyboard works fine for OS-level cases like System Preferences > Security & Privacy.

OK, in that case I think it’s safe to label the LAContext behaviour a bug. It’s reasonable to expect the public LAContext API to offer the same functionality as the rest of the system.

Please file a bug about this. Make sure to include a sysdiagnose log taken shortly after your isTouchIDAvailable() function has returned false. And I’d appreciate you posting your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Check for Touch ID with the lid closed and a Magic Keyboard with Touch ID
 
 
Q