chromium/third_party/blink/renderer/modules/credentialmanagement/identity_provider.idl

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

dictionary IdentityUserInfo {
  USVString email;
  USVString name;
  USVString givenName;
  USVString picture;
};

dictionary IdentityResolveOptions {
  USVString accountId;
};

// https://fedidcg.github.io/FedCM/#identityprovider
[
    Exposed=Window,
    SecureContext,
    RuntimeEnabled=FedCm
] interface IdentityProvider {
    // Allows an IDP to request user info from its own iframe embeded on an RP.
    [CallWith=ScriptState, RaisesException, MeasureAs=FedCmUserInfo]
    static Promise<sequence<IdentityUserInfo>> getUserInfo(IdentityProviderConfig config);

    [RuntimeEnabled=FedCmIdpSigninStatus, CallWith=ScriptState]
    static void close();

    [RuntimeEnabled=FedCmIdPRegistration, CallWith=ScriptState, ImplementedAs=registerIdentityProvider]
    static Promise<boolean> register(USVString configURL);
    [RuntimeEnabled=FedCmIdPRegistration, CallWith=ScriptState, ImplementedAs=unregisterIdentityProvider]
    static Promise<undefined> unregister(USVString configURL);

    // Allows an IdP to return a token to the RP from the content area, as opposed to
    // over HTTP with the id_assertion_endpoint.
    [RuntimeEnabled=FedCmAuthz, CallWith=ScriptState]
    static Promise<undefined> resolve(USVString token, optional IdentityResolveOptions options = {});
};