1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
8 [scriptable
, uuid(4fe082ae
-6ff0
-4b41
-b24f
-eaa664f6e46a
)]
9 interface nsIOSReauthenticator
: nsISupports
{
11 * This interface provides an abstract way to request that the user
12 * reauthenticate themselves to the operating system. It may be useful in
13 * conjunction with nsIOSKeyStore, whereby consumers of these APIs may
14 * consider some secrets too sensitive to access without first
15 * reauthenticating the user.
19 * // obtain the singleton nsIOSReauthenticator instance
20 * const reauthenticator = Cc["@mozilla.org/security/osreauthenticator;1"]
21 * .getService(Ci.nsIOSReauthenticator);
22 * if (await reauthenticator.asyncReauthenticate()) {
23 * // do something only authenticated users are allowed to do...
25 * // show a "sorry, this isn't allowed" error
30 * Asynchronously cause the operating system to request that the user
31 * reauthenticate. This is typically in the form of a dialog box asking the
32 * user for their login password. The actual behaviour of this depends on the
35 * @param prompt A short string that may be incorporated in the dialog
36 * @return Promise resolving to true if the user successfully authenticated
37 * and false otherwise.
39 [implicit_jscontext
, must_use
]
40 Promise asyncReauthenticateUser
(in ACString prompt
);