mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-24 22:04:42 +00:00
32 lines
907 B
JavaScript
32 lines
907 B
JavaScript
![]() |
function checkWebauthnSupported(button, func) {
|
||
|
let support = document.getElementsByClassName("wa-support");
|
||
|
let noSupport = document.getElementsByClassName("wa-no-support");
|
||
|
if (typeof (PublicKeyCredential) === undefined) {
|
||
|
for (let item of noSupport) {
|
||
|
item.classList.remove('hidden');
|
||
|
}
|
||
|
for (let item of support) {
|
||
|
item.classList.add('hidden');
|
||
|
}
|
||
|
return
|
||
|
}
|
||
|
document.getElementById(button).addEventListener('click', func);
|
||
|
}
|
||
|
|
||
|
function webauthnError(error) {
|
||
|
let err = document.getElementById('wa-error');
|
||
|
err.getElementsByClassName('cause')[0].innerText = error.message;
|
||
|
err.classList.remove('hidden');
|
||
|
}
|
||
|
|
||
|
function bufferDecode(value) {
|
||
|
return decode(value);
|
||
|
}
|
||
|
|
||
|
function bufferEncode(value) {
|
||
|
return encode(value)
|
||
|
.replace(/\+/g, "-")
|
||
|
.replace(/\//g, "_")
|
||
|
.replace(/=/g, "");
|
||
|
}
|