Skip to content
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

Request OS Authentication #117

Open
Richienb opened this issue Jan 23, 2020 · 5 comments
Open

Request OS Authentication #117

Richienb opened this issue Jan 23, 2020 · 5 comments

Comments

@Richienb
Copy link

Ask the user to authenticate with their credentials to verify a sensitive operation. An example of this is the show password button in Chrome password manager.

Here's an API example:

const osAuth = require("os-auth");

(async () => {
	const authed = await osAuth()

	if (authed) console.log("User authenticated! Process with the data-sensitive operation.")
	else console.log("User not authenticated.")
})()
@ScottFreeCode
Copy link

The API will probably be more complex than this, since the OS authentication isn't just supposed to check your password and tell an app yes or no so it can decide to do stuff it could, in principle, do anyway (which wouldn't protect much). In the Chrome example, the OS actually encrypts data so even a hacked or buggy version of Chrome couldn't get it, nor could someone who reads Chrome's source to find out where the data is stored; Chrome is asking the OS to actually get that data, and the OS encrypts it for secure storage. Something similar goes for sudo or the ubiquitous Windows admin privileges prompt: the OS itself won't let certain actions be performed unless the user is sufficiently authorized and (re-)authenticates.

That said, I would love to have more cross-platform standard ways to handle either elevated actions or secure data.

@yumitsu
Copy link

yumitsu commented Feb 8, 2020

@Richienb Look at jorangreef/sudo-prompt.

@ssight
Copy link

ssight commented Mar 8, 2020

@Richienb What about something like this?

@Richienb
Copy link
Author

Richienb commented Mar 8, 2020

@ssight That would be good except it needs to support MacOS.

@ssight
Copy link

ssight commented Mar 9, 2020

@Richienb I finally got MacOS to work. It should work on all three major platforms now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants