diff options
author | Matthew Miller <matthew@millerti.me> | 2020-06-02 13:17:18 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2020-06-02 13:17:18 -0700 |
commit | 047413af015302639a1bd23934d9eb23fcbec169 (patch) | |
tree | f4b7e643742852756488d821fe781490d627f5b2 /packages/browser/src/methods/startAssertion.ts | |
parent | ae19fbdf22fb13dd8848370ff201963850682db7 (diff) |
Explicitly define id and type
It turns out that properties on PublicKeyCredentials are non-enumerable getters, so the spread operator won’t pick them up. This means we need to manually re-construct attestation and assertion credentials when we convert them to JSON.
Diffstat (limited to 'packages/browser/src/methods/startAssertion.ts')
-rw-r--r-- | packages/browser/src/methods/startAssertion.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/browser/src/methods/startAssertion.ts b/packages/browser/src/methods/startAssertion.ts index 81cad60..b65325b 100644 --- a/packages/browser/src/methods/startAssertion.ts +++ b/packages/browser/src/methods/startAssertion.ts @@ -37,7 +37,7 @@ export default async function startAssertion( throw new Error('Assertion was not completed'); } - const { rawId, response } = credential; + const { id, rawId, response, type } = credential; let userHandle = undefined; if (response.userHandle) { @@ -46,14 +46,14 @@ export default async function startAssertion( // Convert values to base64 to make it easier to send back to the server return { - ...credential, + id, rawId: bufferToBase64URLString(rawId), response: { - ...response, authenticatorData: bufferToBase64URLString(response.authenticatorData), clientDataJSON: bufferToBase64URLString(response.clientDataJSON), signature: bufferToBase64URLString(response.signature), userHandle, }, + type, }; } |