Skip to content

Commit 788c313

Browse files
committed
Move getCC into types
1 parent b36fb83 commit 788c313

4 files changed

Lines changed: 69 additions & 19 deletions

File tree

‎packages/browser/src/helpers/getBrowserCapabilities.ts‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,6 @@ export type BrowserCapabilities = {
120120
signalUnknownCredential: BrowserCapabilitySupport;
121121
};
122122

123-
/**
124-
* Typing specific to the PublicKeyCredential.getClientCapabilities() method that's being wrapped
125-
* above. A capability with an `undefined` value does not mean the feature is unsupported. It may
126-
* simply be that the browser has chosen not to divulge its support for the capability as a more
127-
* specific determination may be factored into e.g. ad-tech's browser fingerprinting that violates
128-
* user privacy against the goals of the browser.
129-
*/
130-
type PublicKeyCredentialClientCapabilities = {
131-
conditionalCreate?: boolean;
132-
conditionalGet?: boolean;
133-
hybridTransport?: boolean;
134-
passkeyPlatformAuthenticator?: boolean;
135-
userVerifyingPlatformAuthenticator?: boolean;
136-
relatedOrigins?: boolean;
137-
signalAllAcceptedCredentials?: boolean;
138-
signalCurrentUserDetails?: boolean;
139-
signalUnknownCredential?: boolean;
140-
};
141-
142123
/**
143124
* Map the tri-state booleans in `PublicKeyCredential.getClientCapablities()` to more descriptive
144125
* values instead.

‎packages/browser/src/types/index.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ export interface PublicKeyCredentialFuture extends PublicKeyCredential {
258258
): PublicKeyCredentialRequestOptions;
259259
// See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson
260260
toJSON(): PublicKeyCredentialJSON;
261+
// See https://w3c.github.io/webauthn/#sctn-getClientCapabilities
262+
getClientCapabilities?(): Promise<PublicKeyCredentialClientCapabilities>;
261263
}
262264

263265
/**
@@ -296,6 +298,27 @@ export type AttestationFormat =
296298
| 'apple'
297299
| 'none';
298300

301+
/**
302+
* Typing specific to the PublicKeyCredential.getClientCapabilities() method that's being wrapped
303+
* above. A capability with an `undefined` value does not mean the feature is unsupported. It may
304+
* simply be that the browser has chosen not to divulge its support for the capability as a more
305+
* specific determination may be factored into e.g. ad-tech's browser fingerprinting that violates
306+
* user privacy against the goals of the browser.
307+
*
308+
* See https://w3c.github.io/webauthn/#typedefdef-publickeycredentialclientcapabilities
309+
*/
310+
type PublicKeyCredentialClientCapabilities = {
311+
conditionalCreate?: boolean;
312+
conditionalGet?: boolean;
313+
hybridTransport?: boolean;
314+
passkeyPlatformAuthenticator?: boolean;
315+
userVerifyingPlatformAuthenticator?: boolean;
316+
relatedOrigins?: boolean;
317+
signalAllAcceptedCredentials?: boolean;
318+
signalCurrentUserDetails?: boolean;
319+
signalUnknownCredential?: boolean;
320+
};
321+
299322
/**
300323
* Equivalent to `Uint8Array` before TypeScript 5.7, and `Uint8Array<ArrayBuffer>` in TypeScript 5.7
301324
* and beyond.

‎packages/server/src/types/index.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ export interface PublicKeyCredentialFuture extends PublicKeyCredential {
258258
): PublicKeyCredentialRequestOptions;
259259
// See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson
260260
toJSON(): PublicKeyCredentialJSON;
261+
// See https://w3c.github.io/webauthn/#sctn-getClientCapabilities
262+
getClientCapabilities?(): Promise<PublicKeyCredentialClientCapabilities>;
261263
}
262264

263265
/**
@@ -296,6 +298,27 @@ export type AttestationFormat =
296298
| 'apple'
297299
| 'none';
298300

301+
/**
302+
* Typing specific to the PublicKeyCredential.getClientCapabilities() method that's being wrapped
303+
* above. A capability with an `undefined` value does not mean the feature is unsupported. It may
304+
* simply be that the browser has chosen not to divulge its support for the capability as a more
305+
* specific determination may be factored into e.g. ad-tech's browser fingerprinting that violates
306+
* user privacy against the goals of the browser.
307+
*
308+
* See https://w3c.github.io/webauthn/#typedefdef-publickeycredentialclientcapabilities
309+
*/
310+
type PublicKeyCredentialClientCapabilities = {
311+
conditionalCreate?: boolean;
312+
conditionalGet?: boolean;
313+
hybridTransport?: boolean;
314+
passkeyPlatformAuthenticator?: boolean;
315+
userVerifyingPlatformAuthenticator?: boolean;
316+
relatedOrigins?: boolean;
317+
signalAllAcceptedCredentials?: boolean;
318+
signalCurrentUserDetails?: boolean;
319+
signalUnknownCredential?: boolean;
320+
};
321+
299322
/**
300323
* Equivalent to `Uint8Array` before TypeScript 5.7, and `Uint8Array<ArrayBuffer>` in TypeScript 5.7
301324
* and beyond.

‎packages/types/src/index.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ export interface PublicKeyCredentialFuture extends PublicKeyCredential {
248248
): PublicKeyCredentialRequestOptions;
249249
// See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson
250250
toJSON(): PublicKeyCredentialJSON;
251+
// See https://w3c.github.io/webauthn/#sctn-getClientCapabilities
252+
getClientCapabilities?(): Promise<PublicKeyCredentialClientCapabilities>;
251253
}
252254

253255
/**
@@ -286,6 +288,27 @@ export type AttestationFormat =
286288
| 'apple'
287289
| 'none';
288290

291+
/**
292+
* Typing specific to the PublicKeyCredential.getClientCapabilities() method that's being wrapped
293+
* above. A capability with an `undefined` value does not mean the feature is unsupported. It may
294+
* simply be that the browser has chosen not to divulge its support for the capability as a more
295+
* specific determination may be factored into e.g. ad-tech's browser fingerprinting that violates
296+
* user privacy against the goals of the browser.
297+
*
298+
* See https://w3c.github.io/webauthn/#typedefdef-publickeycredentialclientcapabilities
299+
*/
300+
type PublicKeyCredentialClientCapabilities = {
301+
conditionalCreate?: boolean;
302+
conditionalGet?: boolean;
303+
hybridTransport?: boolean;
304+
passkeyPlatformAuthenticator?: boolean;
305+
userVerifyingPlatformAuthenticator?: boolean;
306+
relatedOrigins?: boolean;
307+
signalAllAcceptedCredentials?: boolean;
308+
signalCurrentUserDetails?: boolean;
309+
signalUnknownCredential?: boolean;
310+
};
311+
289312
/**
290313
* Equivalent to `Uint8Array` before TypeScript 5.7, and `Uint8Array<ArrayBuffer>` in TypeScript 5.7
291314
* and beyond.

0 commit comments

Comments
 (0)