Skip to content

Commit 243bf35

Browse files
saschanazsandersn
authored andcommitted
add Credential Management types (#711)
1 parent 0453323 commit 243bf35

File tree

4 files changed

+153
-0
lines changed

4 files changed

+153
-0
lines changed

baselines/dom.generated.d.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ interface ConvolverOptions extends AudioNodeOptions {
250250
disableNormalization?: boolean;
251251
}
252252

253+
interface CredentialCreationOptions {
254+
signal?: AbortSignal;
255+
}
256+
257+
interface CredentialRequestOptions {
258+
mediation?: CredentialMediationRequirement;
259+
signal?: AbortSignal;
260+
}
261+
253262
interface CustomEventInit<T = any> extends EventInit {
254263
detail?: T;
255264
}
@@ -3588,6 +3597,28 @@ declare var CountQueuingStrategy: {
35883597
new(options: { highWaterMark: number }): CountQueuingStrategy;
35893598
};
35903599

3600+
interface Credential {
3601+
readonly id: string;
3602+
readonly type: string;
3603+
}
3604+
3605+
declare var Credential: {
3606+
prototype: Credential;
3607+
new(): Credential;
3608+
};
3609+
3610+
interface CredentialsContainer {
3611+
create(options?: CredentialCreationOptions): Promise<Credential | null>;
3612+
get(options?: CredentialRequestOptions): Promise<Credential | null>;
3613+
preventSilentAccess(): Promise<void>;
3614+
store(credential: Credential): Promise<Credential>;
3615+
}
3616+
3617+
declare var CredentialsContainer: {
3618+
prototype: CredentialsContainer;
3619+
new(): CredentialsContainer;
3620+
};
3621+
35913622
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
35923623
interface Crypto {
35933624
readonly subtle: SubtleCrypto;
@@ -10669,6 +10700,7 @@ interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils,
1066910700
readonly authentication: WebAuthentication;
1067010701
readonly clipboard: Clipboard;
1067110702
readonly cookieEnabled: boolean;
10703+
readonly credentials: CredentialsContainer;
1067210704
readonly doNotTrack: string | null;
1067310705
gamepadInputEmulation: GamepadInputEmulationType;
1067410706
readonly geolocation: Geolocation;
@@ -18796,6 +18828,7 @@ type ChannelInterpretation = "speakers" | "discrete";
1879618828
type ClientTypes = "window" | "worker" | "sharedworker" | "all";
1879718829
type CompositeOperation = "replace" | "add" | "accumulate";
1879818830
type CompositeOperationOrAuto = "replace" | "add" | "accumulate" | "auto";
18831+
type CredentialMediationRequirement = "silent" | "optional" | "required";
1879918832
type DirectionSetting = "" | "rl" | "lr";
1880018833
type DisplayCaptureSurfaceType = "monitor" | "window" | "application" | "browser";
1880118834
type DistanceModelType = "linear" | "inverse" | "exponential";
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
[Exposed=Window, SecureContext]
2+
interface Credential {
3+
readonly attribute USVString id;
4+
readonly attribute DOMString type;
5+
};
6+
7+
[SecureContext]
8+
interface mixin CredentialUserData {
9+
readonly attribute USVString name;
10+
readonly attribute USVString iconURL;
11+
};
12+
13+
partial interface Navigator {
14+
[SecureContext, SameObject] readonly attribute CredentialsContainer credentials;
15+
};
16+
17+
[Exposed=Window, SecureContext]
18+
interface CredentialsContainer {
19+
Promise<Credential?> get(optional CredentialRequestOptions options);
20+
Promise<Credential> store(Credential credential);
21+
Promise<Credential?> create(optional CredentialCreationOptions options);
22+
Promise<void> preventSilentAccess();
23+
};
24+
25+
dictionary CredentialData {
26+
required USVString id;
27+
};
28+
29+
dictionary CredentialRequestOptions {
30+
CredentialMediationRequirement mediation = "optional";
31+
AbortSignal signal;
32+
};
33+
34+
enum CredentialMediationRequirement {
35+
"silent",
36+
"optional",
37+
"required"
38+
};
39+
40+
dictionary CredentialCreationOptions {
41+
AbortSignal signal;
42+
};
43+
44+
[Constructor(HTMLFormElement form),
45+
Constructor(PasswordCredentialData data),
46+
Exposed=Window,
47+
SecureContext]
48+
interface PasswordCredential : Credential {
49+
readonly attribute USVString password;
50+
};
51+
PasswordCredential includes CredentialUserData;
52+
53+
partial dictionary CredentialRequestOptions {
54+
boolean password = false;
55+
};
56+
57+
dictionary PasswordCredentialData : CredentialData {
58+
USVString name;
59+
USVString iconURL;
60+
required USVString origin;
61+
required USVString password;
62+
};
63+
64+
typedef (PasswordCredentialData or HTMLFormElement) PasswordCredentialInit;
65+
66+
partial dictionary CredentialCreationOptions {
67+
PasswordCredentialInit password;
68+
};
69+
70+
[Constructor(FederatedCredentialInit data),
71+
Exposed=Window,
72+
SecureContext]
73+
interface FederatedCredential : Credential {
74+
readonly attribute USVString provider;
75+
readonly attribute DOMString? protocol;
76+
};
77+
FederatedCredential includes CredentialUserData;
78+
79+
dictionary FederatedCredentialRequestOptions {
80+
sequence<USVString> providers;
81+
sequence<DOMString> protocols;
82+
};
83+
84+
partial dictionary CredentialRequestOptions {
85+
FederatedCredentialRequestOptions federated;
86+
};
87+
88+
dictionary FederatedCredentialInit : CredentialData {
89+
USVString name;
90+
USVString iconURL;
91+
required USVString origin;
92+
required USVString provider;
93+
DOMString protocol;
94+
};
95+
96+
partial dictionary CredentialCreationOptions {
97+
FederatedCredentialInit federated;
98+
};

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
"title": "Compatibility",
99
"deprecated": true
1010
},
11+
{
12+
"url": "https://www.w3.org/TR/credential-management-1/",
13+
"title": "Credential Management"
14+
},
1115
{
1216
"url": "https://www.w3.org/TR/css-animations-1/",
1317
"title": "CSS Animations"

inputfiles/removedTypes.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
}
8888
}
8989
},
90+
"FederatedCredential": null,
9091
"HTMLAreasCollection": null,
9192
"HTMLBodyElement": {
9293
"properties": {
@@ -134,6 +135,7 @@
134135
"MSPortRange": null,
135136
"MSStreamReader": null,
136137
"OverconstrainedErrorEvent": null,
138+
"PasswordCredential": null,
137139
"Screen": {
138140
"methods": {
139141
"method": {
@@ -282,6 +284,22 @@
282284
},
283285
"dictionaries": {
284286
"dictionary": {
287+
"CredentialCreationOptions": {
288+
"members": {
289+
"member": {
290+
"federated": null,
291+
"password": null
292+
}
293+
}
294+
},
295+
"CredentialRequestOptions": {
296+
"members": {
297+
"member": {
298+
"federated": null,
299+
"password": null
300+
}
301+
}
302+
},
285303
"ObjectURLOptions": null,
286304
"RTCIceGatherOptions": {
287305
"members": {

0 commit comments

Comments
 (0)