Blame security/manager/ssl/nsILocalCertService.idl

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