8000 feat: add Touch ID authentication support for macOS by codebytere · Pull Request #16707 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add Touch ID authentication support for macOS #16707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 14, 2019
Merged

Conversation

codebytere
Copy link
Member
@codebytere codebytere commented Feb 3, 2019

Description of Change

Resolves #16699.

This PR adds Touch ID authentication support for macOS with two new SystemPreferences methods.

  1. systemPreferences.promptForTouchID() returns a Promise that resolves with true if successful and rejects with an error message if authentication could not be completed.
  2. systemPreferences.isTouchIDAvailable() returns a Boolean that's true if this device is a Mac running a supported OS that has the necessary hardware for Touch ID and false otherwise.

Checklist

Release Notes

Notes: Added native Touch ID authentication support for macOS.

@codebytere codebytere requested review from a team February 3, 2019 23:27
@codebytere codebytere changed the title Touch auth feat: add Touch ID authentication support for macOS Feb 3, 2019
@codebytere codebytere force-pushed the touch-auth branch 3 times, most recently from bb3dec9 to 3273849 Compare February 4, 2019 15:04
@ckerr ckerr added the semver/minor backwards-compatible functionality label Feb 12, 2019
@@ -93,6 +93,8 @@ void SystemPreferences::BuildPrototype(
.SetMethod("setAppLevelAppearance",
&SystemPreferences::SetAppLevelAppearance)
.SetMethod("getSystemColor", &SystemPreferences::GetSystemColor)
.SetMethod("isTouchIDAvailable", &SystemPreferences::IsTouchIDAvailable)
.SetMethod("promptTouchID", &SystemPreferences::PromptTouchID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is SystemPreferences the right place for this functionality? It doesn't seem preference-related.

Copy link
Member Author
@codebytere codebytere Feb 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought about this too, but wasn't sure there was any more appropriate place 🤔

On Mac, this is where one would modify and deal with settings for TouchID though, so i think it's best of our available options

codebytere and others added 2 commits February 13, 2019 12:34
Clarify how `systemPreferences.canPromptTouchID()` and `systemPreferences.promptTouchID()` behave on older versions of macOS.
Copy link
Member
@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the fixes! LGTM

@codebytere
Copy link
Member Author
codebytere commented Feb 13, 2019

I gotta forward-declare the instance method biometryType and the enum LABiometryType 👇

update: 🍐'd through it

@codebytere codebytere merged commit 46a24c8 into master Feb 14, 2019
@release-clerk
Copy link
release-clerk bot commented Feb 14, 2019

Release Notes Persisted

Added native Touch ID authentication support for macOS.

@trop
Copy link
Contributor
trop bot commented Feb 14, 2019

I have automatically backported this PR to "5-0-x", please check out #16952

@trop trop bot removed the target/5-0-x label Feb 14, 2019
@alchaplinsky
Copy link

Was this eventually removed from 5.0x? It doesn't look like systemPreferences module has these methods anymore. And they are also missing in the documentation

@codebytere
Copy link
Member Author
codebytere commented Jun 27, 2019

@alchaplinsky this was never backported to 5; it's only present in 6 onward. Online documentation reflects the latest stable version (5-0-x) so that's why it's not present there either.

@alchaplinsky
Copy link

@codebytere Ok, got it. Thank you for response. Will try out v6.

@sunknudsen
Copy link

This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set Access Control Constants like kSecAccessControlUserPresence on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with node-keytar, such that one would store an encryption key with node-keytar and only fetch it if promptTouchID() resolves.

How does one “set Access Control Constants like kSecAccessControlUserPresence on their keychain entry”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Touch ID support for macOS
5 participants
0