From 92d5ad6af713cb9883b347e3f99e49e6bd31141f Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 5 Jun 2019 16:23:57 +0900 Subject: [PATCH] add Credential Management types --- baselines/dom.generated.d.ts | 33 ++++++++ inputfiles/idl/Credential Management.widl | 98 +++++++++++++++++++++++ inputfiles/idlSources.json | 4 + inputfiles/removedTypes.json | 18 +++++ 4 files changed, 153 insertions(+) create mode 100644 inputfiles/idl/Credential Management.widl diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 7b1cfbc32..8492ba822 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -250,6 +250,15 @@ interface ConvolverOptions extends AudioNodeOptions { disableNormalization?: boolean; } +interface CredentialCreationOptions { + signal?: AbortSignal; +} + +interface CredentialRequestOptions { + mediation?: CredentialMediationRequirement; + signal?: AbortSignal; +} + interface CustomEventInit extends EventInit { detail?: T; } @@ -3578,6 +3587,28 @@ declare var CountQueuingStrategy: { new(options: { highWaterMark: number }): CountQueuingStrategy; }; +interface Credential { + readonly id: string; + readonly type: string; +} + +declare var Credential: { + prototype: Credential; + new(): Credential; +}; + +interface CredentialsContainer { + create(options?: CredentialCreationOptions): Promise; + get(options?: CredentialRequestOptions): Promise; + preventSilentAccess(): Promise; + store(credential: Credential): Promise; +} + +declare var CredentialsContainer: { + prototype: CredentialsContainer; + new(): CredentialsContainer; +}; + /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ interface Crypto { readonly subtle: SubtleCrypto; @@ -10657,6 +10688,7 @@ interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, readonly authentication: WebAuthentication; readonly clipboard: Clipboard; readonly cookieEnabled: boolean; + readonly credentials: CredentialsContainer; readonly doNotTrack: string | null; gamepadInputEmulation: GamepadInputEmulationType; readonly geolocation: Geolocation; @@ -18787,6 +18819,7 @@ type ChannelInterpretation = "speakers" | "discrete"; type ClientTypes = "window" | "worker" | "sharedworker" | "all"; type CompositeOperation = "replace" | "add" | "accumulate"; type CompositeOperationOrAuto = "replace" | "add" | "accumulate" | "auto"; +type CredentialMediationRequirement = "silent" | "optional" | "required"; type DirectionSetting = "" | "rl" | "lr"; type DisplayCaptureSurfaceType = "monitor" | "window" | "application" | "browser"; type DistanceModelType = "linear" | "inverse" | "exponential"; diff --git a/inputfiles/idl/Credential Management.widl b/inputfiles/idl/Credential Management.widl new file mode 100644 index 000000000..cc0697dbc --- /dev/null +++ b/inputfiles/idl/Credential Management.widl @@ -0,0 +1,98 @@ +[Exposed=Window, SecureContext] +interface Credential { + readonly attribute USVString id; + readonly attribute DOMString type; +}; + +[SecureContext] +interface mixin CredentialUserData { + readonly attribute USVString name; + readonly attribute USVString iconURL; +}; + +partial interface Navigator { + [SecureContext, SameObject] readonly attribute CredentialsContainer credentials; +}; + +[Exposed=Window, SecureContext] +interface CredentialsContainer { + Promise get(optional CredentialRequestOptions options); + Promise store(Credential credential); + Promise create(optional CredentialCreationOptions options); + Promise preventSilentAccess(); +}; + +dictionary CredentialData { + required USVString id; +}; + +dictionary CredentialRequestOptions { + CredentialMediationRequirement mediation = "optional"; + AbortSignal signal; +}; + +enum CredentialMediationRequirement { + "silent", + "optional", + "required" +}; + +dictionary CredentialCreationOptions { + AbortSignal signal; +}; + +[Constructor(HTMLFormElement form), + Constructor(PasswordCredentialData data), + Exposed=Window, + SecureContext] +interface PasswordCredential : Credential { + readonly attribute USVString password; +}; +PasswordCredential includes CredentialUserData; + +partial dictionary CredentialRequestOptions { + boolean password = false; +}; + +dictionary PasswordCredentialData : CredentialData { + USVString name; + USVString iconURL; + required USVString origin; + required USVString password; +}; + +typedef (PasswordCredentialData or HTMLFormElement) PasswordCredentialInit; + +partial dictionary CredentialCreationOptions { + PasswordCredentialInit password; +}; + +[Constructor(FederatedCredentialInit data), + Exposed=Window, + SecureContext] +interface FederatedCredential : Credential { + readonly attribute USVString provider; + readonly attribute DOMString? protocol; +}; +FederatedCredential includes CredentialUserData; + +dictionary FederatedCredentialRequestOptions { + sequence providers; + sequence protocols; +}; + +partial dictionary CredentialRequestOptions { + FederatedCredentialRequestOptions federated; +}; + +dictionary FederatedCredentialInit : CredentialData { + USVString name; + USVString iconURL; + required USVString origin; + required USVString provider; + DOMString protocol; +}; + +partial dictionary CredentialCreationOptions { + FederatedCredentialInit federated; +}; diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index c1dea27be..74b73628a 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -8,6 +8,10 @@ "title": "Compatibility", "deprecated": true }, + { + "url": "https://www.w3.org/TR/credential-management-1/", + "title": "Credential Management" + }, { "url": "https://www.w3.org/TR/css-animations-1/", "title": "CSS Animations" diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 5b9855e72..87f5faa68 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -87,6 +87,7 @@ } } }, + "FederatedCredential": null, "HTMLAreasCollection": null, "HTMLBodyElement": { "properties": { @@ -134,6 +135,7 @@ "MSPortRange": null, "MSStreamReader": null, "OverconstrainedErrorEvent": null, + "PasswordCredential": null, "Screen": { "methods": { "method": { @@ -276,6 +278,22 @@ }, "dictionaries": { "dictionary": { + "CredentialCreationOptions": { + "members": { + "member": { + "federated": null, + "password": null + } + } + }, + "CredentialRequestOptions": { + "members": { + "member": { + "federated": null, + "password": null + } + } + }, "ObjectURLOptions": null, "RTCIceGatherOptions": { "members": {