Skip to content
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

PublicKeyCredential: Remove NotAllowed exceptions and add security exceptions #38617

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ For example, the key `extension:appid` can be used to check if the [`appid` exte

The returned {{jsxref("Promise")}} may be rejected with the following values:

- `NotAllowedError` {{domxref("DOMException")}}
- : The Web Authentication API is not allowed in the current browsing context.
For example, it might be blocked by a permission policy.
- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Description

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ browser-compat: api.PublicKeyCredential.getClientExtensionResults

{{APIRef("Web Authentication API")}}{{securecontext_header}}

The **`getClientExtensionResults()`** method of the
{{domxref("PublicKeyCredential")}} interface returns a map between the identifiers of extensions requested during credential creation or authentication, and their results after processing by the user agent.
The **`getClientExtensionResults()`** method of the {{domxref("PublicKeyCredential")}} interface returns a map between the identifiers of extensions requested during credential creation or authentication, and their results after processing by the user agent.

During the creation or fetching of a `PublicKeyCredential` (via
{{domxref("CredentialsContainer.create()","navigator.credentials.create()")}} and
{{domxref("CredentialsContainer.get()","navigator.credentials.get()")}} respectively), it is possible
to request "custom" processing by the client for different extensions, specified in the `publicKey` option's `extensions` property. You can find more information about requesting the different extensions in [Web Authentication extensions](/en-US/docs/Web/API/Web_Authentication_API/WebAuthn_extensions).
During the creation or fetching of a `PublicKeyCredential` (via {{domxref("CredentialsContainer.create()","navigator.credentials.create()")}} and {{domxref("CredentialsContainer.get()","navigator.credentials.get()")}} respectively), it is possible to request "custom" processing by the client for different extensions, specified in the `publicKey` option's `extensions` property. You can find more information about requesting the different extensions in [Web Authentication extensions](/en-US/docs/Web/API/Web_Authentication_API/WebAuthn_extensions).

> **Note:** `getClientExtensionResults()` only returns the results from extensions processed by the user agent (client). The results from extensions processed by the authenticator can be found in the [authenticator data](/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data) available in {{domxref("AuthenticatorAssertionResponse.authenticatorData")}}.

Expand All @@ -32,6 +28,11 @@ None.

A {{jsxref("Map", "map")}}, with each entry being an extensions' identifier string as the key, and the output from the processing of the extension by the client as the value.

### Exceptions

- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Examples

```js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ None.

A {{jsxref("Promise")}} which resolves to a boolean value indicating whether or not conditional mediation is available.

### Exceptions

The returned {{jsxref("Promise")}} may be rejected with the following values:

- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Examples

Before invoking a conditional WebAuthn API call, check if:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ None.

### Return value

A {{jsxref("Promise")}} which resolves to a boolean value indicating whether or
a not a user-verifying platform authenticator is available.
A {{jsxref("Promise")}} which resolves to a boolean value indicating whether or a not a user-verifying platform authenticator is available.

> [!NOTE]
> In earlier versions of the specification, the boolean also
> conveyed the consent of the user to disclose such an authenticator existed.
> In earlier versions of the specification, the boolean also conveyed the consent of the user to disclose such an authenticator existed.

### Exceptions

The returned {{jsxref("Promise")}} may be rejected with the following values:

- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ A {{domxref("PublicKeyCredentialCreationOptions")}} object.

- `EncodingError` {{domxref("DOMException")}}
- : Thrown the `options` object cannot be converted into a {{domxref("PublicKeyCredentialCreationOptions")}} object.
- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Description

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ A {{domxref("PublicKeyCredentialRequestOptions")}} instance.

- `EncodingError` {{domxref("DOMException")}}
- : Thrown if any part of the `options` object cannot be converted into a {{domxref("PublicKeyCredentialRequestOptions")}} instance.
- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Description

Expand Down
5 changes: 5 additions & 0 deletions files/en-us/web/api/publickeycredential/tojson/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ The object properties are:

- When authenticating a user the returned value will be a JSON-type representation version of {{domxref("AuthenticatorAssertionResponse")}} where buffer values have been [base64url](/en-US/docs/Glossary/Base64) encoded.

### Exceptions

- `SecurityError` {{domxref("DOMException")}}
- : The RP domain is not valid.

## Examples

When registering a new user, a relying party server will supply information about the expected credentials to the web app.
Expand Down