Chromium Code Reviews| Index: chrome/common/extensions/api/certificate_provider.idl |
| diff --git a/chrome/common/extensions/api/certificate_provider.idl b/chrome/common/extensions/api/certificate_provider.idl |
| index 4062d0445b3a48d68be9c5f97b3a383d372e9416..9d776847fe92c7b94f31922a91e6e54d171d3d9c 100644 |
| --- a/chrome/common/extensions/api/certificate_provider.idl |
| +++ b/chrome/common/extensions/api/certificate_provider.idl |
| @@ -13,6 +13,18 @@ namespace certificateProvider { |
| SHA512 |
| }; |
| + enum RequestType { |
| + PIN, |
| + PUK |
| + }; |
| + |
| + enum ErrorType { |
| + INVALID_PIN, |
| + INVALID_PUK, |
| + MAX_ATTEMPTS_EXCEEDED, |
| + UNKNOWN_ERROR |
| + }; |
| + |
| [noinline_doc] dictionary CertificateInfo { |
| // Must be the DER encoding of a X.509 certificate. Currently, only |
| // certificates of RSA keys are supported. |
| @@ -25,6 +37,9 @@ namespace certificateProvider { |
| }; |
| [noinline_doc] dictionary SignRequest { |
| + // The unique ID to be used if extension will require a PIN. |
| + long signRequestId; |
|
stevenjb
2016/07/25 18:57:57
Nice solution, thanks. This needs to be optional t
igorcov1
2016/07/26 10:21:11
I think Chrome should always include this paramete
stevenjb
2016/07/26 16:10:15
Making this required would break any existing usag
igorcov1
2016/07/26 17:45:29
I don't see how it would break anything existent.
stevenjb
2016/07/28 00:41:56
I guess that JS being JS it won't break the code.
|
| + |
| // The digest that must be signed. |
| ArrayBuffer digest; |
| @@ -36,6 +51,37 @@ namespace certificateProvider { |
| ArrayBuffer certificate; |
| }; |
| + dictionary RequestPinDetails { |
| + // The ID given by Chrome when in SignRequest. |
| + long signRequestId; |
| + |
| + // The type of code requested, PIN or PUK. Default is PIN. |
| + RequestType? requestType; |
| + |
| + // The error message to display for user. Default - no error. |
|
stevenjb
2016/07/25 18:57:57
The error request would be set if a previous faile
igorcov1
2016/07/26 10:21:11
Done.
|
| + ErrorType? errorType; |
| + |
| + // The number of attempts left. |
|
stevenjb
2016/07/25 18:57:57
We should expand this comment, e.g.:
// The number
igorcov1
2016/07/26 10:21:11
Updated, thanks.
|
| + long? attemptsLeft; |
| + }; |
| + |
| + dictionary StopPinRequestDetails { |
|
stevenjb
2016/07/25 18:57:57
We should probably pass signRequestId here.
igorcov1
2016/07/26 10:21:11
At this point we can use the active extension_id (
stevenjb
2016/07/26 16:10:15
Conceivably couldn't the extension issue more than
emaxx
2016/07/26 17:36:21
+1 for passing request id here.
Even though our c
igorcov1
2016/07/26 17:45:29
Yes, we don't plan to keep a queue of requests. If
igorcov1
2016/07/27 11:58:20
Added the ID here and made the details parameter i
|
| + ErrorType? errorType; |
| + }; |
| + |
| + dictionary PinResponseDetails { |
| + DOMString? userInput; |
|
stevenjb
2016/07/25 18:57:57
This should also provide an error value, e.g. 'REQ
igorcov1
2016/07/26 10:21:11
Good point, but this is intended to be achieved us
stevenjb
2016/07/26 16:10:15
Fair point. We should document that, and define wh
igorcov1
2016/07/26 17:45:29
Done.
|
| + }; |
| + |
| + // A callback called when the dialog gets resolved with the user input, or |
| + // when the dialog request finishes unsuccessfully (e.g. the dialog was |
| + // canceled by the user or was not allowed to be shown). |
| + callback RequestPinCallback = void (optional PinResponseDetails details); |
| + |
| + // The callback to be used by Chrome to send to middleware application the |
| + // status from their request to close PIN dialog for user. |
| + callback StopPinRequestCallback = void (); |
|
stevenjb
2016/07/25 18:57:57
Do we actually need this?
igorcov1
2016/07/26 10:21:11
It might be useful in case the user closes the dia
stevenjb
2016/07/26 16:10:15
Acknowledged.
|
| + |
| // The callback provided by the extension that Chrome uses to report back |
| // rejected certificates. See <code>CertificatesCallback</code>. |
| callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); |
| @@ -76,4 +122,14 @@ namespace certificateProvider { |
| static void onSignDigestRequested(SignRequest request, |
| SignCallback reportCallback); |
| }; |
| + |
| + interface Functions { |
| + // Requests the PIN from user. |
| + static void requestPin(RequestPinDetails details, |
| + RequestPinCallback callback); |
| + |
| + // Stops the pin request started by $(ref:requestPin) function. |
| + static void stopPinRequest(optional StopPinRequestDetails details, |
| + StopPinRequestCallback callback); |
| + }; |
| }; |