-
Notifications
You must be signed in to change notification settings - Fork 16.1k
feat: Implement password delegate for NSS #41205
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
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
This event is only dispatched when NSS requires a certificate to unlock a certificate. This typically happens when the client certificate is stored on a smart card. So I really don't know how to add a test for that. If you think of a way to do, I will be happy to add some unit tests. |
Do you have feedback about that pull request? |
861bbee
to
cc7e80c
Compare
I had closed the pull request by accident. I'm still looking for reviews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
gin_helper::internal::Event::New(isolate); | ||
v8::Local<v8::Object> event_object = event.ToV8().As<v8::Object>(); | ||
gin_helper::Dictionary dict(isolate, event_object); | ||
dict.Set("hostName", server_.host()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dict.Set("hostName", server_.host()); | |
dict.Set("hostname", server_.host()); |
Based on casing seen in other APIs (setCertificateVerifyProc)
const { app } = require('electron') | ||
|
||
async function passwordPromptUI (text) { | ||
return new Promise((resolve, reject) => { | ||
// display UI to prompt user for password | ||
// ... | ||
// ... | ||
resolve('the password') | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great if we had a working example here. It's too bad our dialog
API doesn't support basic input prompting 🥲
@arenevier rebasing your PR might fix the build errors being seen |
I'm adding a wip label on this PR until the requested changes can be implemented. Please tag |
Introduce an app event client-certificate-request-password. It allows the user to display a UI to prompt for the password. An alternative would have been to implement a class similar to CryptoModulePasswordDialogView, to provide the UI. This might have been simpler for the user, comparing to letting them implement the UI. But it seems like electron does not have an i18n framework, so it's not possible to provide a locale aware UI.
* use a trampoline handler in JS. The api exposed is now app.setClientCertRequestPasswordHandler * use properties on the Event object instead of positional parameters * remove ChromeNSSCryptoModuleDelegate::OnPassword in favor of args->GetNext(&password_)
- backslash escape parametrized TypeScript - rename hostName param to hostname - use base::ScopedAllowBaseSyncPrimitivesForTesting - and then, rename ChromeNSSCryptoModuleDelegate to ElectronNSSCryptoModuleDelegate
6ecab9d
to
5dbb7bf
Compare
@electron/wg-api: I have updated the patch. I think I addressed all the comments. |
@electron/api-wg |
@samuelmaddock: I'm pinging you directly because I'm not sure if the ping to electron/wg-api worked or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
Co-authored-by: Sam Maddock <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
@codebytere @ckerr : could one of you take a look? |
@arenevier we've recently started deploying GitHub actions to run builds/tests for Electron. We're working through some issues with them running in PRs from forked repos. I'll try to get back to you next week once we've resolved the issue so we can get this PR back to a ✅ state and hopefully merged soon. |
@arenevier would you mind rebasing to the latest changes on |
Looks like there is still an issue. |
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
Description of Change
Closes #41188
Introduce an app event client-certificate-request-password. It allows the user to display a UI to prompt for the password.
An alternative would have been to implement a class similar to CryptoModulePasswordDialogView, to provide the UI. This might have been simpler for the user, comparing to letting them implement the UI. But it seems like electron does not have an i18n framework, so it's not possible to provide a locale aware UI.
Checklist
npm test
passesRelease Notes
Notes: Add the event
client-certificate-request-password
to app. It is dispatched when a PIN is needed to unlock a cryptographic device.