Skip to content

Commit 4e786fc

Browse files
author
Frederik Rothenberger
authored
fix: Work around credentials not being enumerable (#860)
This PR fixes an issue that arises from assuming that the `PublicKeyCredential` returned from `navigators.credentials.create` is enumerable.
1 parent ad6ba89 commit 4e786fc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
* fix: work around `PublicKeyCredential` not being enumerable
6+
57
## [1.1.0] - 2024-03-18
68

79
### Added

packages/identity/src/identity/webauthn.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ async function _createCredential(
112112
}
113113

114114
return {
115-
...creds,
115+
// do _not_ use ...creds here, as creds is not enumerable in all cases
116+
id: creds.id,
117+
response: creds.response,
118+
type: creds.type,
119+
authenticatorAttachment: creds.authenticatorAttachment,
120+
getClientExtensionResults: creds.getClientExtensionResults,
116121
// Some password managers will return a Uint8Array, so we ensure we return an ArrayBuffer.
117122
rawId: bufFromBufLike(creds.rawId),
118123
};

0 commit comments

Comments
 (0)