feat: Add Secure Keyboard Entry APIs in macOS (#20678)

* feat: Add Secure Keyboard Entry APIs in macOS

Add methods:
- app.isSecureInputEnabled()
- app.setSecureInputEnabled(enabled)

These enable to prevent other process listens keyboard input events.

* fix: lint error in app.md for #20678

* fix: crash app.setSecureInputEnabled() in password textfield

* fix: export Secure keyboard Entry API to only macOS

* fix: lint error in browser_mac.mm for #20678

* test: add test for app.setSecureKeyboardEntryEnabled in macOS
This commit is contained in:
mtgto 2020-05-22 00:53:44 +09:00 committed by GitHub
parent 5bdf97e7ae
commit 7b55a70a36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 0 deletions

View file

@ -1304,6 +1304,25 @@ app.moveToApplicationsFolder({
Would mean that if an app already exists in the user directory, if the user chooses to 'Continue Move' then the function would continue with its default behavior and the existing app will be trashed and the active app moved into its place.
### `app.isSecureKeyboardEntryEnabled()` _macOS_
Returns `Boolean` - whether `Secure Keyboard Entry` is enabled.
By default this API will return `false`.
### `app.setSecureKeyboardEntryEnabled(enabled)` _macOS_
* `enabled` Boolean - Enable or disable `Secure Keyboard Entry`
Set the `Secure Keyboard Entry` is enabled in your application.
By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.
See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more
details.
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
## Properties
### `app.accessibilitySupportEnabled` _macOS_ _Windows_