IdentityCredential.webidl (4573B)
1 /* -*- Mode: IDL; 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 file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://w3c-fedid.github.io/FedCM. 8 */ 9 10 // https://w3c-fedid.github.io/FedCM/#browser-api-identity-credential-interface 11 [Exposed=Window, SecureContext, 12 Pref="dom.security.credentialmanagement.identity.enabled"] 13 interface IdentityCredential : Credential { 14 [Throws] 15 static Promise<undefined> disconnect(optional IdentityCredentialDisconnectOptions options = {}); 16 readonly attribute UTF8String? token; 17 readonly attribute boolean isAutoSelected; 18 readonly attribute UTF8String configURL; 19 }; 20 21 enum IdentityCredentialRequestOptionsMode { 22 "active", 23 "passive" 24 }; 25 26 dictionary IdentityCredentialRequestOptions { 27 required sequence<IdentityProviderRequestOptions> providers; 28 IdentityCredentialRequestOptionsMode mode = "passive"; 29 }; 30 31 // https://w3c-fedid.github.io/FedCM/#dictdef-identityproviderconfig 32 [GenerateConversionToJS] 33 dictionary IdentityProviderConfig { 34 required UTF8String configURL; 35 required UTF8String clientId; 36 }; 37 38 // https://w3c-fedid.github.io/FedCM/#dictdef-identityproviderrequestoptions 39 [GenerateConversionToJS] 40 dictionary IdentityProviderRequestOptions : IdentityProviderConfig { 41 UTF8String nonce; 42 UTF8String loginHint; 43 UTF8String domainHint; 44 }; 45 46 // https://w3c-fedid.github.io/FedCM/#dictdef-identitycredentialdisconnectoptions 47 dictionary IdentityCredentialDisconnectOptions : IdentityProviderConfig { 48 required UTF8String accountHint; 49 }; 50 51 // https://w3c-fedid.github.io/FedCM/#dictdef-identityproviderwellknown 52 [GenerateInit] 53 dictionary IdentityProviderWellKnown { 54 required sequence<UTF8String> provider_urls; 55 UTF8String accounts_endpoint; 56 }; 57 58 // https://w3c-fedid.github.io/FedCM/#dictdef-identityprovidericon 59 dictionary IdentityProviderIcon { 60 required UTF8String url; 61 unsigned long size; 62 }; 63 64 // https://w3c-fedid.github.io/FedCM/#dictdef-identityproviderbranding 65 dictionary IdentityProviderBranding { 66 USVString background_color; 67 USVString color; 68 sequence<IdentityProviderIcon> icons; 69 USVString name; 70 }; 71 72 // https://w3c-fedid.github.io/FedCM/#dictdef-identityproviderapiconfig 73 [GenerateInit, GenerateConversionToJS] 74 dictionary IdentityProviderAPIConfig { 75 required UTF8String accounts_endpoint; 76 // We do not want to gather consent for identity providers, so we 77 // omit this requirement and its use: https://github.com/w3c-fedid/FedCM/issues/703 78 // required UTF8String client_metadata_endpoint; 79 required UTF8String id_assertion_endpoint; 80 UTF8String disconnect_endpoint; 81 IdentityProviderBranding branding; 82 UTF8String account_label; 83 }; 84 85 86 // https://w3c-fedid.github.io/FedCM/#dictdef-identityprovideraccount 87 dictionary IdentityProviderAccount { 88 required USVString id; 89 USVString name; 90 USVString email; 91 USVString tel; 92 USVString username; 93 USVString given_name; 94 USVString picture; 95 sequence<USVString> approved_clients; 96 sequence<UTF8String> login_hints; 97 sequence<UTF8String> domain_hints; 98 sequence<UTF8String> label_hints; 99 }; 100 101 // https://w3c-fedid.github.io/FedCM/#dictdef-identityprovideraccountlist 102 [GenerateInit, GenerateConversionToJS] 103 dictionary IdentityProviderAccountList { 104 sequence<IdentityProviderAccount> accounts; 105 }; 106 107 // https://fedidcg.github.io/FedCM/#dictdef-identityproviderclientmetadata 108 [GenerateInit, GenerateConversionToJS] 109 dictionary IdentityProviderClientMetadata { 110 USVString privacy_policy_url; 111 USVString terms_of_service_url; 112 }; 113 114 // https://w3c-fedid.github.io/FedCM/#dictdef-identityassertionresponse 115 [GenerateInit] 116 dictionary IdentityAssertionResponse { 117 UTF8String token; 118 UTF8String continue_on; 119 }; 120 121 // https://w3c-fedid.github.io/FedCM/#dictdef-disconnectedaccount 122 [GenerateInit] 123 dictionary DisconnectedAccount { 124 required UTF8String account_id; 125 }; 126 127 // https://w3c-fedid.github.io/FedCM/#dictdef-identityresolveoptions 128 dictionary IdentityResolveOptions { 129 UTF8String accountId; 130 }; 131 132 // https://w3c-fedid.github.io/FedCM/#identityprovider 133 [Exposed=Window, SecureContext, 134 Pref="dom.security.credentialmanagement.identity.enabled"] 135 interface IdentityProvider { 136 static undefined close(); 137 [Throws] 138 static Promise<undefined> resolve(UTF8String token, optional IdentityResolveOptions options = {}); 139 // static Promise<sequence<IdentityUserInfo>> getUserInfo(IdentityProviderConfig config); Bug 1945589: Not yet implemented 140 };