Skip to content
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

fix: Work around credentials not being enumerable #860

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

frederikrothenberger
Copy link
Member

Description

This PR fixes an issue that arises from assuming that the PublicKeyCredential returned from navigators.credentials.create is enumerable.

How Has This Been Tested?

Manual testing.

Checklist:

  • My changes follow the guidelines in CONTRIBUTING.md.
  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

This PR fixes an issue that arises from assuming that the
`PublicKeyCredential` returned from `navigators.credentials.create`
is enumerable.
@frederikrothenberger frederikrothenberger requested a review from a team as a code owner March 19, 2024 14:25
@@ -112,7 +112,12 @@ async function _createCredential(
}

return {
...creds,
// do _not_ use ...creds here, as creds is not enumerable in all cases
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krpeacock: Isn't there any Typescript feature that would these types of issues (trying to spread non-enumerable objects)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything that extends a class, Record or object will inherit the Iterable trait. If the browser is not allowing us to spread fields from the creds response, there is an issue with the TypeScript-provided dom types

@krpeacock krpeacock merged commit 4e786fc into dfinity:main Mar 19, 2024
15 checks passed
@frederikrothenberger frederikrothenberger deleted the frederik/fix-webauthn2 branch March 19, 2024 16:14
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.

None yet

2 participants