AutorÃa | Ultima modificación | Ver Log |
/**
* For collecting WebAuthn authenticator details on login
*
* @module factor_webauthn/login
* @copyright Catalyst IT
* @author Alex Morris <alex.morris@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("factor_webauthn/login",["factor_webauthn/utils"],(function(utils){return{init:function(getArgs){const idSubmitButton=document.getElementById("id_submitbutton");idSubmitButton&&idSubmitButton.addEventListener("click",(async function(e){if(e.preventDefault(),!navigator.credentials||!navigator.credentials.create)throw new Error("Browser not supported.");if(!1===(getArgs=JSON.parse(getArgs)).success)throw new Error(getArgs.msg||"unknown error occured");utils.recursiveBase64StrToArrayBuffer(getArgs);const cred=await navigator.credentials.get(getArgs),authenticatorAttestationResponse={id:cred.rawId?utils.arrayBufferToBase64(cred.rawId):null,clientDataJSON:cred.response.clientDataJSON?utils.arrayBufferToBase64(cred.response.clientDataJSON):null,authenticatorData:cred.response.authenticatorData?utils.arrayBufferToBase64(cred.response.authenticatorData):null,signature:cred.response.signature?utils.arrayBufferToBase64(cred.response.signature):null,userHandle:cred.response.userHandle?utils.arrayBufferToBase64(c
red.response.userHandle):null},responseInput=document.getElementById("id_response_input");responseInput.value=JSON.stringify(authenticatorAttestationResponse),responseInput.form.submit()}))}}}));
//# sourceMappingURL=login.min.js.map