w3c / webauthn

Web Authentication: An API for accessing Public Key Credentials
https://w3c.github.io/webauthn/
Other
1.19k stars 178 forks source link

Authenticator Attestation Response's [[transports]] should be an attribute rather than an internal slot. #2080

Closed nbrr closed 5 months ago

nbrr commented 5 months ago

It is recommended for a credential record to register transports. This value is defined as an internal slot accessible through the Authenticator Attestation Response's getTransports method. This puts the RP in an awkward position as to accessing this value :

Although these are implementation specific considerations, the current specification seems to make things unnecessarily difficult.

emlun commented 5 months ago

We would have done this if possible, but unfortunately this is not allowed by the Web IDL definition of an interface attribute:

An attribute is an interface member or namespace member [...] [...] The type of the attribute, after resolving typedefs, must not be a nullable or non-nullable version of any of the following types:

[[transports]] is of sequence type, so it cannot be an attribute of interface AuthenticatorAttestationResponse.

emlun commented 5 months ago

By the way, this is the same reason as for why getClientExtensionResults(), and a few others like it, must also be a getter method rather than a direct attribute.

nbrr commented 5 months ago

Thank you for explaining that @emlun. With this understanding and upon closer look, I notice that level 3 spec introduces use of toJSON(): this actually seems to address the frictions I mentioned?

emlun commented 5 months ago

Ah right - yes, it does! dictionary doesn't have this limitation, so the toJSON() outputs indeed include these getter results as plain attributes.