Skip to content

Commit 412dc9d

Browse files
[Spec] Add output enum for isSecurePaymentConfirmationAvailable
Fixes #284
1 parent d095e26 commit 412dc9d

File tree

1 file changed

+80
-6
lines changed

1 file changed

+80
-6
lines changed

spec.bs

+80-6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ spec: web-authn; urlPrefix: https://w3c.github.io/webauthn/
7373
text: authentication extension; url: authentication-extension
7474
text: extension identifier; url: extension-identifier
7575
text: user member; url: dom-publickeycredentialcreationoptions-user
76+
text: user-verifying platform authenticator; url: user-verifying-platform-authenticator
7677

7778
spec: webdriver; urlPrefix: https://w3c.github.io/webdriver/
7879
type: dfn
@@ -365,7 +366,7 @@ presumes access to await/async, for easier to read promise handling.
365366
const spcAvailable =
366367
PaymentRequest &&
367368
PaymentRequest.isSecurePaymentConfirmationAvailable &&
368-
await PaymentRequest.isSecurePaymentConfirmationAvailable();
369+
(await PaymentRequest.isSecurePaymentConfirmationAvailable()) === 'available';
369370
if (!spcAvailable) {
370371
/* Browser does not support SPC; merchant should fallback to traditional flows. */
371372
}
@@ -658,15 +659,51 @@ A static API is added to {{PaymentRequest}} in order to provide developers a
658659
simplified method of checking whether Secure Payment Confirmation is available.
659660

660661
<xmp class="idl">
662+
enum IsSecurePaymentConfirmationAvailableResult {
663+
"available",
664+
"unavailable-unknown-reason",
665+
"unavailable-feature-not-enabled",
666+
"unavailable-no-permission-policy",
667+
"unavailable-no-user-verifying-platform-authenticator",
668+
};
669+
661670
partial interface PaymentRequest {
662-
static Promise<boolean> isSecurePaymentConfirmationAvailable();
671+
static Promise<IsSecurePaymentConfirmationAvailableResult> isSecurePaymentConfirmationAvailable();
663672
};
664673
</xmp>
665674
<dl dfn-type="attribute" dfn-for="PaymentRequest">
666675
: {{PaymentRequest/isSecurePaymentConfirmationAvailable()}}
667-
:: Upon invocation, a promise is returned that resolves with a value of
668-
`true` if the Secure Payment Confirmation feature is available, or
669-
`false` otherwise.
676+
:: Upon invocation, a promise is returned that resolves with one of the
677+
members of {{IsSecurePaymentConfirmationAvailableResult}}, based on the
678+
current availability of the Secure Payment Confirmation feature.
679+
</dl>
680+
<dl dfn-type="enum-value" dfn-for="IsSecurePaymentConfirmationAvailableResult">
681+
: <dfn>available</dfn>
682+
:: Indicates that the user agent believes that the Secure Payment
683+
Confirmation API is available in the calling frame.
684+
685+
Note: This result does not indicate whether or not any particular [=SPC
686+
credential=] is or will be available.
687+
688+
: <dfn>unavailable-unknown-reason</dfn>
689+
:: Indicates that the Secure Payment Confirmation API is not avaiable in
690+
the calling frame, for an unknown reason. A user agent MAY always choose
691+
to return this result instead of a more specific reason, in order to
692+
protect user privacy.
693+
694+
: <dfn>unavailable-feature-not-enabled</dfn>
695+
:: Indicates that the Secure Payment Confirmation API is not available in
696+
the calling frame, because the feature is not enabled.
697+
698+
: <dfn>unavailable-no-permission-policy</dfn>
699+
:: Indicates that the Secure Payment Confirmation API is not available in
700+
the calling frame, because the frame lacks the "[=payment permission
701+
string|payment=]" permission policy.
702+
703+
: <dfn>unavailable-no-user-verifying-platform-authenticator</dfn>
704+
:: Indicates that the Secure Payment Confirmation API is not available in
705+
the calling frame, because there is no [=user-verifying platform
706+
authenticator=] available.
670707
</dl>
671708

672709
This allows a developer to perform the following check when deciding whether to
@@ -676,13 +713,16 @@ initiate a SPC flow:
676713
const spcAvailable =
677714
PaymentRequest &&
678715
PaymentRequest.isSecurePaymentConfirmationAvailable &&
679-
await PaymentRequest.isSecurePaymentConfirmationAvailable();
716+
await PaymentRequest.isSecurePaymentConfirmationAvailable() === 'available';
680717
</pre>
681718

682719
NOTE: The use of the static {{PaymentRequest/isSecurePaymentConfirmationAvailable}} method is recommended for
683720
SPC feature detection, instead of calling {{PaymentRequest/canMakePayment}} on an already-constructed
684721
PaymentRequest object.
685722

723+
Note: For privacy considerations of this API, see
724+
[[#sctn-fingerprinting-via-is-secure-payment-confirmation-available]].
725+
686726
### Steps to validate payment method data ### {#sctn-steps-to-validate-payment-method-data}
687727

688728
The [=steps to validate payment method data=] for this payment method, for an
@@ -1548,6 +1588,40 @@ they are strong, cross-site identifiers. However in order to obtain them from
15481588
the [=Relying Party=], the merchant already needs an as-strong identifier to
15491589
give to the [=Relying Party=] (e.g., the credit card number).
15501590

1591+
## Fingerprinting via isSecurePaymentConfirmationAvailable ## {#sctn-fingerprinting-via-is-secure-payment-confirmation-available}
1592+
1593+
The {{isSecurePaymentConfirmationAvailable}} API presents a possible
1594+
fingerprinting risk, as it can silently return specific reasons that the
1595+
Secure Payment Confirmation API is not available for a specific frame. These
1596+
reasons are not believed to leak significant information, but should be
1597+
considered:
1598+
1599+
- {{IsSecurePaymentConfirmationAvailableResult/unavailable-feature-not-enabled}}:
1600+
some risk of fingerprinting, depending on under what circumstances the user
1601+
agent considers Secure Payment Confirmation to be available or not. User
1602+
agents are encouraged to make Secure Payment Confirmation available to all
1603+
users (if implementing the specification), or at least to significantly
1604+
sized groups such that no (additional) fingerprinting is possible. For
1605+
example, a user agent may ship Secure Payment Confirmation to all users on
1606+
a given OS but not others - this then reduces the fingerprinting risk to
1607+
no more than the user agent string already reveals.
1608+
- {{IsSecurePaymentConfirmationAvailableResult/unavailable-no-permission-policy}}:
1609+
no (additional) fingerprinting risk, as the "[=payment permission
1610+
string|payment=]" permission policy is already silently detectable by
1611+
attempting to construct a {{PaymentRequest}} object (construction will throw
1612+
an error if the permission policy is not enabled).
1613+
- {{IsSecurePaymentConfirmationAvailableResult/unavailable-no-user-verifying-platform-authenticator}}:
1614+
no (additional) fingerprinting risk over the existing
1615+
{{PublicKeyCredential/isUserVerifyingPlatformAuthenticatorAvailable}} API.
1616+
1617+
In addition to the above considerations, this specification allows a user agent
1618+
to choose to return
1619+
{{IsSecurePaymentConfirmationAvailableResult/unavailable-unknown-reason}} even
1620+
when a specific reason is known, should it wish to in order to preserve user
1621+
privacy. This might be done in the case, e.g., that a user agent has detected
1622+
that the current frame has already accessed other APIs that pose a
1623+
fingerprinting risk.
1624+
15511625
## User opt out ## {#sctn-user-opt-out}
15521626

15531627
The API option {{SecurePaymentConfirmationRequest/showOptOut}} tells the

0 commit comments

Comments
 (0)