This commit is contained in:
Roberto Hidalgo 2023-01-04 15:55:52 -06:00
parent 08f9671aaf
commit f558a35d3d

View File

@ -66,12 +66,13 @@ async function register(challenge) {
console.dir(parsed) console.dir(parsed)
console.info("webauthn: issuing credential creation request to browser") console.info("webauthn: issuing credential creation request to browser")
let credential let credential = await webauthnJSON.create(parsed);
try { let missing = 4 - (credential.response.clientDataJSON.length % 4)
credential = await webauthnJSON.create(parsed); if (missing != 0) {
} catch (err) { while (missing > 0) {
console.error("sigh", err) credential.response.clientDataJSON += "="
throw err missing -= 1
}
} }
console.debug(`webauthn: registering credentials with server: ${JSON.stringify(credential)}`) console.debug(`webauthn: registering credentials with server: ${JSON.stringify(credential)}`)
@ -108,6 +109,13 @@ async function login(challenge, target, config) {
console.debug("webauthn: fetching stored client credentials") console.debug("webauthn: fetching stored client credentials")
let credential = await webauthnJSON.get(parsed); let credential = await webauthnJSON.get(parsed);
let missing = 4 - (credential.response.clientDataJSON.length % 4)
if (missing != 0) {
while (missing > 0) {
credential.response.clientDataJSON += "="
missing -= 1
}
}
config.credentials = "include" config.credentials = "include"
config.headers = config.headers || {} config.headers = config.headers || {}