Do not double encode the userid in webauthn login

* Else login fails with webauthn devices that send the userid
  - Like windows hello

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
Roeland Jago Douma 2020-07-22 09:23:11 +02:00 committed by npmbuildbot[bot]
parent 5b5cc637e8
commit 1a483167e9
3 changed files with 7 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -155,6 +155,10 @@ export default {
return window.btoa(String.fromCharCode(...a)) return window.btoa(String.fromCharCode(...a))
} }
const arrayToString = function(a) {
return String.fromCharCode(...a)
}
return navigator.credentials.get({ publicKey }) return navigator.credentials.get({ publicKey })
.then(data => { .then(data => {
console.debug(data) console.debug(data)
@ -168,7 +172,7 @@ export default {
authenticatorData: arrayToBase64String(new Uint8Array(data.response.authenticatorData)), authenticatorData: arrayToBase64String(new Uint8Array(data.response.authenticatorData)),
clientDataJSON: arrayToBase64String(new Uint8Array(data.response.clientDataJSON)), clientDataJSON: arrayToBase64String(new Uint8Array(data.response.clientDataJSON)),
signature: arrayToBase64String(new Uint8Array(data.response.signature)), signature: arrayToBase64String(new Uint8Array(data.response.signature)),
userHandle: data.response.userHandle ? arrayToBase64String(new Uint8Array(data.response.userHandle)) : null, userHandle: data.response.userHandle ? arrayToString(new Uint8Array(data.response.userHandle)) : null,
}, },
} }
}) })