Skip to content

Conversation

resba
Copy link

@resba resba commented Jan 22, 2025

Cast Uint8Array objects to base64url encoding when preparing the payload so fido2 knows how to process it.

In newer versions of the credential creation function, some software passkeys will return Uint8Array objects where hardware tokens would pass base64 objects for elements like response.clientDataJSON and response.attestationObject.

This would result in those elements being casted as objects which would then fail out when running AuthenticationResponse.from_dict(response) in any of the views trying to process it due to a type where we pass it dict instead of the expected bytes.

Cast Uint8Array objects to base64url encoding when preparing the payload so fido2 knows how to process it
@mkalioby
Copy link
Owner

Thanks for your contribution.

What type of keys can this be tested against?

@resba
Copy link
Author

resba commented Jan 22, 2025

Thanks for your contribution.

What type of keys can this be tested against?

I tested against key generation from Bitwarden and iOS Face ID authenticators using an OSX machine. I would test with Chrome latest.

@mkalioby
Copy link
Owner

Does this mean the current library shouldn't work with Apple Passkeys on Mac OSX?

@resba
Copy link
Author

resba commented Jan 23, 2025

Does this mean the current library shouldn't work with Apple Passkeys on Mac OSX?

AFAIK, when using the library (latest pypi) it attempts to save the passkey then Errors out with a bytes-to-dict TypeError

@mkalioby
Copy link
Owner

Thanks, I'll take the patch for a spin and will let you know.

@mkalioby
Copy link
Owner

Hello @resba,

I tested the current version of the libray (without Patch) on Mac OS X (Sequoia) with Safari (Version 18.2 (20620.1.16.11.8) and it worked as expected, Also, I tried Chrome and it worked fine, Can you please give me more specific version or can you deploy the version anywhere so we can check it together.

@nitmir
Copy link

nitmir commented Aug 10, 2025

Hi @mkalioby

I have the same issue (with bitwarden and samsung pass) but only on Firefox : Uint8Array are not base64 encoded leading to authentication failure.

I applied this patch to fix my issue.

As ArrayBuffer and Uint8Array are 2 types of binary array in javascript, I think it is safe to always base64 both of those types.

Cheers

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.

3 participants