-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Passkeys - JSON.stringify() fallback for various password managers #62917
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for your PR, @@maartenba. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a fallback mechanism for JSON serialization of passkey credentials to handle password managers that don't properly implement PublicKeyCredential.prototype.toJSON
. The change addresses compatibility issues where JSON.stringify()
fails with an "Illegal invocation" error in certain password managers like 1Password.
- Wraps the existing
JSON.stringify(credential)
call in a try-catch block - Implements manual JSON serialization as a fallback when the standard approach fails
- Adds a helper function to convert ArrayBuffer/Uint8Array data to base64url format
.../content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Outdated
Show resolved
Hide resolved
.../content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Outdated
Show resolved
Hide resolved
.../content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Outdated
Show resolved
Hide resolved
.../content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Outdated
Show resolved
Hide resolved
.../content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Outdated
Show resolved
Hide resolved
…harp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js Co-authored-by: Copilot <[email protected]>
…harp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js Co-authored-by: Copilot <[email protected]>
…harp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js Co-authored-by: Copilot <[email protected]>
Since I was pinged, for some long forgotten reason I rewrote the helpers here: |
.../content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Outdated
Show resolved
Hide resolved
…harp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js
Passkeys - JSON.stringify() fallback for various password managers
Some password managers do not implement
PublicKeyCredential.prototype.toJSON
correctly, which is required forJSON.stringify()
to work when serializing a passkey credential - e.g. https://www.1password.community/discussions/1password/typeerror-illegal-invocation-in-chrome-browser/47399This PR adds a fallback to work with various password managers.