summaryrefslogtreecommitdiffstats
path: root/security/manager/ssl/nsILocalCertService.idl
diff options
context:
space:
mode:
Diffstat (limited to 'security/manager/ssl/nsILocalCertService.idl')
-rw-r--r--security/manager/ssl/nsILocalCertService.idl69
1 files changed, 69 insertions, 0 deletions
diff --git a/security/manager/ssl/nsILocalCertService.idl b/security/manager/ssl/nsILocalCertService.idl
new file mode 100644
index 000000000..a452683d9
--- /dev/null
+++ b/security/manager/ssl/nsILocalCertService.idl
@@ -0,0 +1,69 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIX509Cert;
+interface nsILocalCertGetCallback;
+interface nsILocalCertCallback;
+
+[scriptable, uuid(9702fdd4-4c2c-439c-ba2e-19cda018eb99)]
+interface nsILocalCertService : nsISupports
+{
+ /**
+ * Get or create a new self-signed X.509 cert to represent this device over a
+ * secure transport, like TLS.
+ *
+ * The cert is stored permanently in the profile's key store after first use,
+ * and is valid for 1 year. If an expired or otherwise invalid cert is found
+ * with the nickname supplied here, it is removed and a new one is made.
+ *
+ * @param nickname Nickname that identifies the cert
+ * @param cb Callback to be notified with the result
+ */
+ void getOrCreateCert(in ACString nickname, in nsILocalCertGetCallback cb);
+
+ /**
+ * Remove a X.509 cert with the given nickname.
+ *
+ * @param nickname Nickname that identifies the cert
+ * @param cb Callback to be notified with the result
+ */
+ void removeCert(in ACString nickname, in nsILocalCertCallback cb);
+
+ /**
+ * Whether calling |getOrCreateCert| or |removeCert| will trigger a login
+ * prompt to be displayed. Generally this happens if the user has set a
+ * master password, but has not yet logged in.
+ */
+ readonly attribute boolean loginPromptRequired;
+};
+
+[scriptable, uuid(cc09633e-7c70-4093-a9cf-79ab676ca8a9)]
+interface nsILocalCertGetCallback : nsISupports
+{
+ /**
+ * Called with the result of the getOrCreateCert operation above.
+ *
+ * @param cert Requested cert, or null if some error
+ * @param result Result code from the get operation
+ */
+ void handleCert(in nsIX509Cert cert, in nsresult result);
+};
+
+[scriptable, uuid(518124e9-55e6-4e23-97c0-4995b3a1bec6)]
+interface nsILocalCertCallback : nsISupports
+{
+ /**
+ * Called with the result of the removeCert operation above.
+ *
+ * @param result Result code from the operation
+ */
+ void handleResult(in nsresult result);
+};
+
+%{ C++
+#define LOCALCERTSERVICE_CONTRACTID \
+ "@mozilla.org/security/local-cert-service;1"
+%}