- md5
- 64bf9be0974d8868deaf5c0b9676a94d
- sha1
- 9e4701d7749075d1ee750e097f144b411c146e88
- sha256
- 9f8ad9821af0677f119a299d87d4c1445e972b2ec5f98b39a1902e0f97a778d5
window.Joomla=window.Joomla||{},((a,b)=>{'use strict';const c=(a,b="")=>{let d="";return Object.keys(a).forEach(e=>"object"==typeof a[e]?void(d+=`${c(a[e],e)}`):(0<d.length&&(d+="&"),void(d+=""===b?`${encodeURIComponent(e)}=${encodeURIComponent(a[e])}`:`${encodeURIComponent(b)}[${encodeURIComponent(e)}]=${encodeURIComponent(a[e])}`))),d},d=b=>{a.renderMessages({error:[b]})};a.plgSystemWebauthnCreateCredentials=(e,f)=>{if(!("credentials"in navigator))return void a.renderMessages({error:[a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_NO_BROWSER_SUPPORT")]});const g=b.getElementById(e);if(!g)return;const h=JSON.parse(atob(g.dataset.public_key)),i=atob(g.dataset.postback_url),j=b=>btoa(String.fromCharCode(...b)),k=a=>{let b=a.replace(/-/g,"+").replace(/_/g,"/");const c=b.length%4;if(c){if(1===c)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");b+=Array(5-c).join("=")}return b};h.challenge=Uint8Array.from(window.atob(k(h.challenge)),a=>a.charCodeAt(0)),h.user.id=Uint8Array.from(window.atob(h.user.id),a=>a.charCodeAt(0)),h.excludeCredentials&&(h.excludeCredentials=h.excludeCredentials.map(a=>(a.id=Uint8Array.from(window.atob(k(a.id)),a=>a.charCodeAt(0)),a))),navigator.credentials.create({publicKey:h}).then(e=>{const g={id:e.id,type:e.type,rawId:j(new Uint8Array(e.rawId)),response:{clientDataJSON:j(new Uint8Array(e.response.clientDataJSON)),attestationObject:j(new Uint8Array(e.response.attestationObject))}},h={option:"com_ajax",group:"system",plugin:"webauthn",format:"raw",akaction:"create",encoding:"raw",data:btoa(JSON.stringify(g))};a.request({url:i,method:"POST",data:c(h),onSuccess(a){const c=b.querySelectorAll(f);if(c){const b=c[0];b.outerHTML=a}},onError:a=>{d(`${a.status} ${a.statusText}`)}})}).catch(a=>{d(a)})},a.plgSystemWebauthnEditLabel=(e,f)=>{const g=b.getElementById(f);if(!g)return!1;const h=atob(g.dataset.postback_url),i=e.parentElement.parentElement,j=i.dataset.credential_id,k=i.querySelectorAll("td"),l=k[0],m=k[1],n=m.querySelectorAll("button"),o=n[0],p=n[1],q=l.innerText,r=b.createElement("input");r.type="text",r.name="label",r.defaultValue=q;const s=b.createElement("button");s.className="btn btn-success btn-sm",s.innerText=a.JText._("PLG_SYSTEM_WEBAUTHN_MANAGE_BTN_SAVE_LABEL"),s.addEventListener("click",()=>{const b=r.value;if(""!==b){a.request({url:h,method:"POST",data:c({option:"com_ajax",group:"system",plugin:"webauthn",format:"json",encoding:"json",akaction:"savelabel",credential_id:j,new_label:b}),onSuccess(b){let c=!1;try{c=JSON.parse(b)}catch(a){c="true"===b}!0!==c&&d(a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_LABEL_NOT_SAVED"))},onError:b=>{d(`${a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_LABEL_NOT_SAVED")} -- ${b.status} ${b.statusText}`)}})}return l.innerText=b,o.disabled=!1,p.disabled=!1,!1},!1);const t=b.createElement("button");return t.className="btn btn-danger btn-sm",t.innerText=a.JText._("PLG_SYSTEM_WEBAUTHN_MANAGE_BTN_CANCEL_LABEL"),t.addEventListener("click",()=>(l.innerText=q,o.disabled=!1,p.disabled=!1,!1),!1),l.innerHTML="",l.appendChild(r),l.appendChild(s),l.appendChild(t),o.disabled=!0,p.disabled=!0,!1},a.plgSystemWebauthnDelete=(e,f)=>{const g=b.getElementById(f);if(!g)return!1;const h=atob(g.dataset.postback_url),i=e.parentElement.parentElement,j=i.dataset.credential_id,k=i.querySelectorAll("td"),l=k[1],m=l.querySelectorAll("button"),n=m[0],o=m[1];n.disabled=!0,o.disabled=!0;return a.request({url:h,method:"POST",data:c({option:"com_ajax",group:"system",plugin:"webauthn",format:"json",encoding:"json",akaction:"delete",credential_id:j}),onSuccess(b){let c=!1;try{c=JSON.parse(b)}catch(a){c="true"===b}return!0===c?void i.parentElement.removeChild(i):void d(a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_NOT_DELETED"))},onError:b=>{n.disabled=!1,o.disabled=!1,d(`${a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_NOT_DELETED")} -- ${b.status} ${b.statusText}`)}}),!1},b.addEventListener("DOMContentLoaded",()=>{const c=b.getElementById("plg_system_webauthn-manage-add");c&&c.addEventListener("click",({currentTarget:b})=>{a.plgSystemWebauthnCreateCredentials(b.getAttribute("data-random-id"),"#plg_system_webauthn-management-interface")});const d=[].slice.call(b.querySelectorAll(".plg_system_webauthn-manage-edit"));d.length&&d.forEach(b=>{b.addEventListener("click",({currentTarget:b})=>{a.plgSystemWebauthnEditLabel(b,b.getAttribute("data-random-id"))})});const e=[].slice.call(b.querySelectorAll(".plg_system_webauthn-manage-delete"));e.length&&e.forEach(b=>{b.addEventListener("click",({currentTarget:b})=>{a.plgSystemWebauthnDelete(b,b.getAttribute("data-random-id"))})})})})(window,Joomla);
No other release has this exact content. See every version of this file.