-
Notifications
You must be signed in to change notification settings - Fork 180
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
PRF inputs should be BufferSource instead of ArrayBuffer #1851
Comments
@emlun Is this similar to the issues previously mentioned about challenge and other types where the JS will need to base64 encode/decode to actually get this into a buffer though? Should we just try to nip this one early and make it base64urlsafe instead and get the browser to decode it? |
No, I don't think it's very similar. Both of these types are already byte array types, just slightly different flavours of it. And no, I think that having some parameters be |
If we are going to aim for consistency here, then should we also add this to the to/from base64 for the related browser methods then? |
Yes, it's already covered in §5.1.8. Deserialize Registration ceremony options - PublicKeyCredential’s parseCreationOptionsFromJSON() Method:
|
Absolutely. Thank you. (I'll fix in Chromium too.) |
I don't think it's worth splitting the IDL just for the output. That causes additional code size in browsers too because an extra object needs to be supported.
|
In other places where WebAuthn takes a binary input it takes a BufferSource so that, e.g., a `Uint8Array` can be passed. See w3c/webauthn#1851 Change-Id: If301f45d439bab49ce362d62df51533bf7598f45 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4247939 Reviewed-by: Martin Kreichgauer <martinkr@google.com> Auto-Submit: Adam Langley <agl@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Commit-Queue: Ken Buchanan <kenrb@chromium.org> Cr-Commit-Position: refs/heads/main@{#1105325}
Hm, I see: typedef (ArrayBufferView or ArrayBuffer) BufferSource;
typedef (Int8Array or Int16Array or Int32Array or
Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or
BigInt64Array or BigUint64Array or
Float32Array or Float64Array or DataView) ArrayBufferView; But...
I don't get the same results in Chrome (110.0.5481.77) or Firefox (109.0.1): > new Uint8Array().buffer instanceof ArrayBuffer
true
> new Uint8Array() instanceof ArrayBuffer
false and indeed, I can't find But on the other hand... in order to work with an So ok, yeah, I guess we could go either way. I do agree with not splitting the IDL just for this. It seems a bit inappropriate to use a union type for output, but I agree that So ok, this will be fixed by 5ebc257. Thanks! |
Throughout the WebAuthn API we use
BufferSource
for binary input parameters (e.g.,PublicKeyCredentialCreationOptions.challenge
,PublicKeyCredentialUserEntity.id
) andArrayBuffer
for binary return values (e.g.,PublicKeyCredential.rawId
,AuthenticatorAttestationResponse.attestationObject
). However theprf
extension usesArrayBuffer
for both input parameters and output return values. This means that this code example:generates the following error in Chrome Canary (112.0.5580.0):
This can be worked around using
new Uint8Array(...).buffer
, but is not in line with how the rest of the API works.Proposed Change
AuthenticationExtensionsPRFValues
into two versions: one for input and one for output.ArrayBuffer
toBufferSource
in the one used in client extension inputs.The text was updated successfully, but these errors were encountered: