Skip to content

Commit 4998b07

Browse files
committed
Deserialize authentication response properly in content script
1 parent 87e1f1f commit 4998b07

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

webext/add-on/content.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,15 @@ async function cloneCredentialResponse(credential) {
7070
response.clientDataJSON = Uint8Array.fromBase64(clientDataJSON, options)
7171
const authenticatorData = Uint8Array.fromBase64(credential.response.authenticatorData, options)
7272
response.authenticatorData = cloneInto(authenticatorData, response)
73-
const signature = Uint8Array.fromBase64(credential.response.signature)
73+
const signature = Uint8Array.fromBase64(credential.response.signature, options)
7474
response.signature = cloneInto(signature, response)
75-
const userHandle = Uint8Array.fromBase64(credential.response.userHandle)
76-
response.userHandle = cloneInto(userHandle, response)
75+
if (credential.response.userHandle) {
76+
const userHandle = Uint8Array.fromBase64(credential.response.userHandle, options)
77+
response.userHandle = cloneInto(userHandle, response)
78+
}
79+
else {
80+
response.userHandle = null
81+
}
7782
}
7883
else {
7984
throw cloneInto(new Error("Unknown credential response type received"), window)
@@ -145,4 +150,4 @@ function getCredential(request) {
145150
const { requestId, promise } = startRequest();
146151
webauthnPort.postMessage({ requestId, cmd: 'get', options, })
147152
return promise.then(cloneCredentialResponse)
148-
};
153+
};

0 commit comments

Comments
 (0)