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

Let specs define their own default mediation requirement #258

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 25 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ spec:css-syntax-3;
internal slot named <dfn for="Credential" attribute>\[[origin]]</dfn>, which stores the [=origin=]
for which the {{Credential}} may be [=effective=].

Credential interfaces can define a <dfn for="Credential" export>default get mediation</dfn> and
<dfn for="Credential" export>default create mediation</dfn> as an {{CredentialMediationRequirement}} enum value.
Together, they establish the default [[#mediation-requirements]] for when none are supplied by the developer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when two credential types define two different mediation types?


### `Credential` Internal Methods ### {#credential-internal-methods}

The {{Credential}} [=interface object=] features several [=internal methods=] facilitating
Expand Down Expand Up @@ -700,7 +704,7 @@ spec:css-syntax-3;

<pre class="idl">
dictionary CredentialRequestOptions {
CredentialMediationRequirement mediation = "optional";
CredentialMediationRequirement mediation;
AbortSignal signal;
};
</pre>
Expand Down Expand Up @@ -988,6 +992,11 @@ spec:css-syntax-3;
1. If |interfaces| is [=set/empty=], then return[=a promise rejected with=]
a "{{NotSupportedError}}" {{DOMException}}.

1. If |options|.{{CredentialRequestOptions/mediation}} was not passed,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I believe

Suggested change
1. If |options|.{{CredentialRequestOptions/mediation}} was not passed,
1. If |options|.{{CredentialRequestOptions/mediation}} is `null` or `undefined`,

might be more accurate.

set |options|.{{CredentialRequestOptions/mediation}} to one of the following values:
1. If the |interfaces| together define a [=Credential/default get mediation=], that enum value.
1. Otherwise, {{CredentialMediationRequirement/optional}}.

1. [=set/For each=] |interface| of |interfaces|:

1. If |options|.{{CredentialRequestOptions/mediation}} is
Expand Down Expand Up @@ -1194,6 +1203,11 @@ spec:css-syntax-3;

1. Let |interfaces| be the [=set=] of |options|' <a>relevant credential interface objects</a>.

1. If |options|.{{CredentialRequestOptions/mediation}} was not passed,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same)

set |options|.{{CredentialRequestOptions/mediation}} to one of the following values:
1. If the |interfaces| together define a [=Credential/default create mediation=], that enum value.
1. Otherwise, {{CredentialMediationRequirement/optional}}.

1. Return [=a promise rejected with=] `NotSupportedError` if any of the following statements
are true:

Expand Down Expand Up @@ -2477,6 +2491,16 @@ spec:css-syntax-3;
mediation=], define `ExampleCredential/isConditionalMediationAvailable()`
to return a new {{Promise}} that [=resolves=] with `true`.

1. Optionally, define a [=Credential/default get mediation=] and, optionally, a [=Credential/default create mediation=].

<div class="example">
<blockquote>
The <strong>default get mediation</strong> for the `ExampleCredential` is "{{CredentialMediationRequirement/required}}".
</blockquote>
</div>

Additionally, a specification can add its own set of restriction around what mediations are allowed to be passed into the API.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be more explicit about the internal methods.


1. Following the procedure in [[#sctn-registry-requirements]], add an entry to the
[[#sctn-cred-type-registry|Credential Type Registry]] for the new
"example" [=credential type registry/credential type=] and its corresponding:
Expand Down
Loading