diff --git a/Demo/wwwroot/js/custom.login.js b/Demo/wwwroot/js/custom.login.js index 20cf9273..7fd650e4 100644 --- a/Demo/wwwroot/js/custom.login.js +++ b/Demo/wwwroot/js/custom.login.js @@ -37,14 +37,9 @@ async function handleSignInSubmit(event) { return; } - // todo: switch this to coercebase64 - const challenge = makeAssertionOptions.challenge.replace(/-/g, "+").replace(/_/g, "/"); - makeAssertionOptions.challenge = Uint8Array.from(atob(challenge), c => c.charCodeAt(0)); - - // fix escaping. Change this to coerce + makeAssertionOptions.challenge = coerceToArrayBuffer(makeAssertionOptions.challenge); makeAssertionOptions.allowCredentials.forEach(function (listItem) { - var fixedId = listItem.id.replace(/\_/g, "/").replace(/\-/g, "+"); - listItem.id = Uint8Array.from(atob(fixedId), c => c.charCodeAt(0)); + listItem.id = coerceToArrayBuffer(listItem.id); }); console.log("Assertion options", makeAssertionOptions); diff --git a/Demo/wwwroot/js/mfa.login.js b/Demo/wwwroot/js/mfa.login.js index 82a8c28c..a200a6a6 100644 --- a/Demo/wwwroot/js/mfa.login.js +++ b/Demo/wwwroot/js/mfa.login.js @@ -42,14 +42,9 @@ async function handleSignInSubmit(event) { return; } - // todo: switch this to coercebase64 - const challenge = makeAssertionOptions.challenge.replace(/-/g, "+").replace(/_/g, "/"); - makeAssertionOptions.challenge = Uint8Array.from(atob(challenge), c => c.charCodeAt(0)); - - // fix escaping. Change this to coerce + makeAssertionOptions.challenge = coerceToArrayBuffer(makeAssertionOptions.challenge); makeAssertionOptions.allowCredentials.forEach(function (listItem) { - var fixedId = listItem.id.replace(/\_/g, "/").replace(/\-/g, "+"); - listItem.id = Uint8Array.from(atob(fixedId), c => c.charCodeAt(0)); + listItem.id = coerceToArrayBuffer(listItem.id); }); console.log("Assertion options", makeAssertionOptions); diff --git a/Demo/wwwroot/js/passwordless.login.js b/Demo/wwwroot/js/passwordless.login.js index 49b22914..a10573da 100644 --- a/Demo/wwwroot/js/passwordless.login.js +++ b/Demo/wwwroot/js/passwordless.login.js @@ -35,14 +35,9 @@ async function handleSignInSubmit(event) { return; } - // todo: switch this to coercebase64 - const challenge = makeAssertionOptions.challenge.replace(/-/g, "+").replace(/_/g, "/"); - makeAssertionOptions.challenge = Uint8Array.from(atob(challenge), c => c.charCodeAt(0)); - - // fix escaping. Change this to coerce + makeAssertionOptions.challenge = coerceToArrayBuffer(makeAssertionOptions.challenge); makeAssertionOptions.allowCredentials.forEach(function (listItem) { - var fixedId = listItem.id.replace(/\_/g, "/").replace(/\-/g, "+"); - listItem.id = Uint8Array.from(atob(fixedId), c => c.charCodeAt(0)); + listItem.id = coerceToArrayBuffer(listItem.id); }); console.log("Assertion options", makeAssertionOptions); diff --git a/Demo/wwwroot/js/usernameless.login.js b/Demo/wwwroot/js/usernameless.login.js index 83095137..341e999b 100644 --- a/Demo/wwwroot/js/usernameless.login.js +++ b/Demo/wwwroot/js/usernameless.login.js @@ -35,14 +35,9 @@ async function handleSignInSubmit(event) { return; } - // todo: switch this to coercebase64 - const challenge = makeAssertionOptions.challenge.replace(/-/g, "+").replace(/_/g, "/"); - makeAssertionOptions.challenge = Uint8Array.from(atob(challenge), c => c.charCodeAt(0)); - - // fix escaping. Change this to coerce + makeAssertionOptions.challenge = coerceToArrayBuffer(makeAssertionOptions.challenge); makeAssertionOptions.allowCredentials.forEach(function (listItem) { - var fixedId = listItem.id.replace(/\_/g, "/").replace(/\-/g, "+"); - listItem.id = Uint8Array.from(atob(fixedId), c => c.charCodeAt(0)); + listItem.id = coerceToArrayBuffer(listItem.id); }); console.log("Assertion options", makeAssertionOptions);