Skip to content

Add userAgentAllowsProtocol static method#221

Merged
marcoscaceres merged 24 commits into
mainfrom
tc-219-isProtocolSupportedByClient
Jun 25, 2025
Merged

Add userAgentAllowsProtocol static method#221
marcoscaceres merged 24 commits into
mainfrom
tc-219-isProtocolSupportedByClient

Conversation

@timcappalli

@timcappalli timcappalli commented Apr 18, 2025

Copy link
Copy Markdown
Collaborator

Closes #219

The following tasks have been completed:

Implementation commitment:

Documentation and checks

  • Affects privacy
  • Affects security
  • Pinged MDN
  • Updated Explainer
  • Updated digitalcredentials.dev

Preview | Diff

@RByers RByers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for doing this, I think it probably is important and valuable given WebKit's plans to not support some popular protocols. Should we perhaps define this to call an internal function, which then we also call from the main processing parts of the spec and return a well-defined error for when the result is 'false'? @marcoscaceres @mohamedamir WDYT?

Comment thread index.html Outdated
@timcappalli timcappalli requested a review from a team as a code owner April 21, 2025 16:14
Comment thread index.html Outdated
@timcappalli timcappalli requested a review from MasterKale April 22, 2025 13:45

@TallTed TallTed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor text changes for clarity

Comment thread index.html Outdated
Comment thread index.html Outdated

@MasterKale MasterKale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems like a good compromise across verifiers, browsers, and platforms 🤔

@marcoscaceres

Copy link
Copy Markdown
Collaborator

Hey all, please see #168 ... I proposed a different way of doing this there that is, IMO, more developer friendly and avoid the "support" question... that the browser recognizes the protocol string does not imply "support" for it.

I suggest we refactor this pull request to align more fully with #168

@marcoscaceres marcoscaceres left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please see #168

Comment thread index.html Outdated
@timcappalli timcappalli added the agenda+ Add to the weekly agenda label May 13, 2025
@npdoty

npdoty commented May 14, 2025

Copy link
Copy Markdown

Is this intended to only reveal information on what the browser version supports passing through and specifically not to reveal any details of what wallets are available, what the user has configured, what credentials they have, whether they have another device that supports credentials, etc.? (I know I raise this question every time it comes up, but we haven't written down the answer, so I keep asking.)

If so, we should add normative requirements that indicate that.

@timcappalli

timcappalli commented May 14, 2025

Copy link
Copy Markdown
Collaborator Author

Is this intended to only reveal information on what the browser version supports passing through and specifically not to reveal any details of what wallets are available, what the user has configured, what credentials they have, whether they have another device that supports credentials, etc.? (I know I raise this question every time it comes up, but we haven't written down the answer, so I keep asking.)

If so, we should add normative requirements that indicate that.

Essentially: "can you pass a request with this protocol to the next component"

There is no possible way for it to reveal any details about wallets or credentials. It just returns a boolean given a protocol identifier.

@npdoty

npdoty commented May 14, 2025

Copy link
Copy Markdown

Browsers could modify the response based on some knowledge of wallet availability or configuration. I think we should just specify that the UA shouldn't use that kind of knowledge for a customized value, they should only describe browser-level support without user/device/app/wallet configuration detail.

@timcappalli

Copy link
Copy Markdown
Collaborator Author

Browsers could modify the response based on some knowledge of wallet availability or configuration

Not sure I follow. The browser is the only party handling this request and response.

@npdoty

npdoty commented May 14, 2025

Copy link
Copy Markdown

As in, a browser vendor trying to implement this section could try to use their knowledge of system/app/wallet/user-configuration properties to modify the return value, and I think this API should tell the browser vendor implementer not to do that.

@timcappalli

Copy link
Copy Markdown
Collaborator Author

Gotcha. I'm not sure how we write something like that given each browser has their own method of determining what the response should be. Do you have some suggested text?

@npdoty

npdoty commented May 14, 2025

Copy link
Copy Markdown

I can try to propose something (tomorrow, likely) that would set some SHOULD NOT/MUST NOT conditions to try to capture what I think is the agreement.

Comment thread index.html Outdated
@timcappalli

Copy link
Copy Markdown
Collaborator Author

2025-05-28 call: make it static and come up with a better name (something similar to canRequestForProtocolReachWallets())

@MasterKale

Copy link
Copy Markdown
Contributor

I believe I've found some guidance on how to determine when to define a method as asynchronous vs synchronous. The W3C's Web Platform Design Principles suggest to me that it's best to go with async by default:

https://www.w3.org/TR/design-principles/#async-by-default

Due to current limitations, some specific areas of the web platform lack asynchronous support. Therefore having support for synchronous methods in addition to asynchronous methods can be beneficial for usability. Consider these cases an exception, and have a clear path for deprecation of the synchronous methods as web platform capabilities evolve.

We should probably take this into account as we continue to discuss the shape of this method.

@MasterKale

Copy link
Copy Markdown
Contributor

cc @marcoscaceres on this ⬆️

@npdoty

npdoty commented May 29, 2025

Copy link
Copy Markdown

Since this method isn't intended to invoke user permission or a detailed request to another resource (in fact, I believe we are specifically prohibiting that, because it's just supposed to be a browser support check, not a check of available resources), I think it makes more sense to stay synchronous:
https://www.w3.org/TR/design-principles/#synchronous

@timcappalli timcappalli changed the title Add isProtocolSupportedByClient static method Add clientAllowsProtocols static method May 29, 2025
@timcappalli timcappalli changed the title Add clientAllowsProtocols static method Add clientAllowsProtocol static method May 29, 2025
Comment thread index.html Outdated
timcappalli and others added 23 commits June 26, 2025 09:39
Co-authored-by: Matthew Miller <matthew@millerti.me>
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Christian Bormann <8774236+c2bo@users.noreply.github.com>
Co-authored-by: Nick Doty <npdoty@ischool.berkeley.edu>
Co-authored-by: Matthew Miller <matthew@millerti.me>
Co-authored-by: Mohamed Amir Yosef <mohamed.amir@gmail.com>
Co-authored-by: Mohamed Amir Yosef <mohamed.amir@gmail.com>
Co-authored-by: Marcos Cáceres <marcosc@apple.com>
Co-authored-by: Marcos Cáceres <marcosc@apple.com>
Co-authored-by: Marcos Cáceres <marcosc@apple.com>
@marcoscaceres marcoscaceres force-pushed the tc-219-isProtocolSupportedByClient branch from a6742d7 to 063b6b6 Compare June 25, 2025 23:47

@marcoscaceres marcoscaceres left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@marcoscaceres marcoscaceres merged commit 50c962a into main Jun 25, 2025
1 check passed
@marcoscaceres marcoscaceres deleted the tc-219-isProtocolSupportedByClient branch June 25, 2025 23:49
@hlflanagan

Copy link
Copy Markdown

Discussed on DC API Series B call, 25 June 2025

@marcoscaceres

Copy link
Copy Markdown
Collaborator

Sent a PR to add this to WebKit WebKit/WebKit#47283

Thanks for preparing the tests, @timcappalli!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a means for developers to check protocols allowed by user agents