1
0
Fork 0
firefox/toolkit/components/credentialmanagement/nsICredentialChooserService.idl
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

93 lines
4.1 KiB
Text

/* 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"
webidl BrowsingContext;
webidl CredentialChooserOption;
interface mozIDOMWindow;
interface nsICredentialChosenCallback;
interface nsIPrincipal;
interface nsIURI;
[scriptable, uuid(673ddc19-03e2-4b30-a868-06297e8fed89)]
interface nsICredentialChooserService : nsISupports {
/**
* Show UI to allow the user to make a choice between credentials
*
* @param browsingContext The top-level browsing context of the context requesting a credential.
* @param credentials The options the user should choose from
* @param callback A callback to notify when the user makes a choice
*/
void showCredentialChooser(in BrowsingContext browsingContext, in Array<jsval> credentials, in nsICredentialChosenCallback callback);
/**
* Dismiss the credential chooser UI
*
* @param browsingContext The top-level browsing context of the context requesting a credential.
*/
void cancelCredentialChooser(in BrowsingContext browsingContext);
/**
* A service function to help any UI. Fetches and serializes images to
* data urls, which can be used in chrome UI.
*
* @param window Window which should perform the fetch
* @param uri Icon location to be fetched from
* @returns A promise resolving with the data URI encoded as a string representing the icon that was loaded
*/
Promise fetchImageToDataURI(in mozIDOMWindow window, in nsIURI uri);
/**
* A helper function that performs precisely the right Fetch for the well-known resource for FedCM.
*
* @param {nsIURI} uri Well known resource location
* @param {nsIPrincipal} triggeringPrincipal Principal of the IDP triggering this request
* @returns A promise that will be the result of fetching the resource and parsing the body as JSON,
* or reject along the way.
*/
Promise fetchWellKnown(in nsIURI uri, in nsIPrincipal triggeringPrincipal);
/**
* A helper function that performs precisely the right Fetch for the IDP configuration resource for FedCM.
*
* @param {nsIURI} uri Well known resource location
* @param {nsIPrincipal} triggeringPrincipal Principal of the IDP triggering this request
* @returns A promise that will be the result of fetching the resource and parsing the body as JSON,
* or reject along the way.
*/
Promise fetchConfig(in nsIURI uri, in nsIPrincipal triggeringPrincipal);
/**
* A helper function that performs precisely the right Fetch for the account list for FedCM.
*
* @param {nsIURI} uri Well known resource location
* @param {nsIPrincipal} triggeringPrincipal Principal of the IDP triggering this request
* @returns A promise that will be the result of fetching the resource and parsing the body as JSON,
* or reject along the way.
*/
Promise fetchAccounts(in nsIURI uri, in nsIPrincipal triggeringPrincipal);
/**
* A helper function that performs precisely the right Fetch for the token request for FedCM.
*
* @param {nsIURI} uri Well known resource location
* @param {string} body Body to be sent with the fetch, pre-serialized.
* @param {nsIPrincipal} triggeringPrincipal Principal of the IDP triggering this request
* @returns A promise that will be the result of fetching the resource and parsing the body as JSON,
* or reject along the way.
*/
Promise fetchToken(in nsIURI uri, in string body, in nsIPrincipal triggeringPrincipal);
/**
* A helper function that performs precisely the right Fetch for the token request for FedCM.
*
* @param {nsIURI} uri Well known resource location
* @param {string} body Body to be sent with the fetch, pre-serialized.
* @param {nsIPrincipal} triggeringPrincipal Principal of the IDP triggering this request
* @returns A promise that will be the result of fetching the resource and parsing the body as JSON,
* or reject along the way.
*/
Promise fetchDisconnect(in nsIURI uri, in string body, in nsIPrincipal triggeringPrincipal);
};