2020-12-02 17:00:04 +01:00
|
|
|
function checkWebauthnSupported(button, func) {
|
2023-06-08 09:27:03 +02:00
|
|
|
let support = document.getElementsByClassName("wa-support");
|
|
|
|
let noSupport = document.getElementsByClassName("wa-no-support");
|
|
|
|
if (!window.PublicKeyCredential) {
|
|
|
|
for (let item of noSupport) {
|
|
|
|
item.classList.remove("hidden");
|
2020-12-02 17:00:04 +01:00
|
|
|
}
|
2023-06-08 09:27:03 +02:00
|
|
|
for (let item of support) {
|
|
|
|
item.classList.add("hidden");
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
document.getElementById(button).addEventListener("click", func);
|
2020-12-02 17:00:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function webauthnError(error) {
|
2023-06-08 09:27:03 +02:00
|
|
|
let err = document.getElementById("wa-error");
|
|
|
|
err.getElementsByClassName("cause")[0].innerText = error.message;
|
|
|
|
err.classList.remove("hidden");
|
2020-12-02 17:00:04 +01:00
|
|
|
}
|
|
|
|
|
2023-06-08 09:27:03 +02:00
|
|
|
function bufferDecode(value, name) {
|
|
|
|
return coerceToArrayBuffer(value, name);
|
2020-12-02 17:00:04 +01:00
|
|
|
}
|
|
|
|
|
2023-06-08 09:27:03 +02:00
|
|
|
function bufferEncode(value, name) {
|
|
|
|
return coerceToBase64Url(value, name);
|
2020-12-02 17:00:04 +01:00
|
|
|
}
|