Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

* fix: work around `PublicKeyCredential` not being enumerable

## [1.1.0] - 2024-03-18

### Added
Expand Down
7 changes: 6 additions & 1 deletion packages/identity/src/identity/webauthn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ async function _createCredential(
}

return {
...creds,
// do _not_ use ...creds here, as creds is not enumerable in all cases
Copy link
Contributor 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

id: creds.id,
response: creds.response,
type: creds.type,
authenticatorAttachment: creds.authenticatorAttachment,
getClientExtensionResults: creds.getClientExtensionResults,
// Some password managers will return a Uint8Array, so we ensure we return an ArrayBuffer.
rawId: bufFromBufLike(creds.rawId),
};
Expand Down