Skip to content

Add Credential Management types #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ interface ConvolverOptions extends AudioNodeOptions {
disableNormalization?: boolean;
}

interface CredentialCreationOptions {
signal?: AbortSignal;
}

interface CredentialRequestOptions {
mediation?: CredentialMediationRequirement;
signal?: AbortSignal;
}

interface CustomEventInit<T = any> extends EventInit {
detail?: T;
}
Expand Down Expand Up @@ -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<Credential | null>;
get(options?: CredentialRequestOptions): Promise<Credential | null>;
preventSilentAccess(): Promise<void>;
store(credential: Credential): Promise<Credential>;
}

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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
98 changes: 98 additions & 0 deletions inputfiles/idl/Credential Management.widl
Original file line number Diff line number Diff line change
@@ -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<Credential?> get(optional CredentialRequestOptions options);
Promise<Credential> store(Credential credential);
Promise<Credential?> create(optional CredentialCreationOptions options);
Promise<void> 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<USVString> providers;
sequence<DOMString> 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;
};
4 changes: 4 additions & 0 deletions inputfiles/idlSources.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions inputfiles/removedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
}
}
},
"FederatedCredential": null,
"HTMLAreasCollection": null,
"HTMLBodyElement": {
"properties": {
Expand Down Expand Up @@ -134,6 +135,7 @@
"MSPortRange": null,
"MSStreamReader": null,
"OverconstrainedErrorEvent": null,
"PasswordCredential": null,
"Screen": {
"methods": {
"method": {
Expand Down Expand Up @@ -276,6 +278,22 @@
},
"dictionaries": {
"dictionary": {
"CredentialCreationOptions": {
"members": {
"member": {
"federated": null,
"password": null
}
}
},
"CredentialRequestOptions": {
"members": {
"member": {
"federated": null,
"password": null
}
}
},
"ObjectURLOptions": null,
"RTCIceGatherOptions": {
"members": {
Expand Down