Skip to content

Commit

Permalink
fix: Work around credentials not being enumerable (#860)
Browse files Browse the repository at this point in the history
This PR fixes an issue that arises from assuming that the
`PublicKeyCredential` returned from `navigators.credentials.create`
is enumerable.
  • Loading branch information
Frederik Rothenberger authored Mar 19, 2024
1 parent ad6ba89 commit 4e786fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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
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

0 comments on commit 4e786fc

Please sign in to comment.