github/webauthn-json

Officially expose `getClientExtensionResults()`

lgarron opened this issue · 4 comments

Right now, we happen to copy the full extensions field:

https://github.com/github/webauthn-json/blob/master/src/webauthn-schema.ts#L30
https://github.com/github/webauthn-json/blob/master/src/webauthn-schema.ts#L58

This allows getClientExtensionResults() to work.
If we ever deconstruct extensions in order to convert a binary field, we need to give an alternative way to expose this.

Oh, seems I actually misunderstood this. getClientExtensionResults() is defined directly on PublicKeyCredential.

https://www.w3.org/TR/webauthn/#iface-pkcredential

We can't call the PublicKeyCredential constructor directly, so one option would be to proxy getClientExtensionResults in the prototype of the returned object.

Another alternative would be to expose the function through another channel, e.g. a callback, or an argument passed by reference. It would be nice to avoid changing the API shape any more than necessary, though.

Based on talking to Googlers, I learned that this is a function (instead of being a field on the returned PublicKeyCredential) purely because of WebIDL quirks. In fact, it was originally defined as a clientExtensionResults field.

https://github.com/w3c/webauthn/pull/633/files

Based on talking to them, there is no reason to expect functionality or performance issues with calling getClientExtensionResults() every time, so I'm going to modify webauthn-json to do this.

I'd like to avoid doing this in the default build, since it makes the library larger for everyone who doesn't need it. It should be possible to make an additional build for this.

I'd like to avoid doing this in the default build, since it makes the library larger for everyone who doesn't need it. It should be possible to make an additional build for this.

Shipped in v0.4.1 under @github/webauthn-json/extended (implemented in de9d7a3).