[{capture append="oxidBlock_content"}] [{capture name="javascripts"}] function arrayToBase64String(a) { return btoa(String.fromCharCode(...a)); } function base64url2base64(input) { input = input .replace(/=/g, "") .replace(/-/g, '+') .replace(/_/g, '/'); const pad = input.length % 4; if(pad) { if(pad === 1) { throw new Error('InvalidLengthError: Input base64url string is the wrong length to determine padding'); } input += new Array(5-pad).join('='); } return input; } function authnregister() { let publicKey = [{$webauthn_publickey_register}]; publicKey.challenge = Uint8Array.from(window.atob(base64url2base64(publicKey.challenge)), function(c){return c.charCodeAt(0);}); publicKey.user.id = Uint8Array.from(window.atob(publicKey.user.id), function(c){return c.charCodeAt(0);}); if (publicKey.excludeCredentials) { publicKey.excludeCredentials = publicKey.excludeCredentials.map(function(data) { data.id = Uint8Array.from(window.atob(base64url2base64(data.id)), function(c){return c.charCodeAt(0);}); return data; }); } navigator.credentials.create({ 'publicKey': publicKey }).then(function(data){ let publicKeyCredential = { id: data.id, type: data.type, rawId: arrayToBase64String(new Uint8Array(data.rawId)), response: { clientDataJSON: arrayToBase64String(new Uint8Array(data.response.clientDataJSON)), attestationObject: arrayToBase64String(new Uint8Array(data.response.attestationObject)) } }; document.getElementById('fncname').value = 'registerNewKey'; document.getElementById('authnvalue').value = btoa(JSON.stringify(publicKeyCredential)); document.getElementById('actionform').submit(); }).catch(function(error){ document.getElementById('errorvalue').value = btoa(JSON.stringify(error)); document.getElementById('actionform').submit(); }); } function deleteItem(id) { document.getElementById('fncname').value = 'deleteKey'; document.getElementById('oxidvalue').value = id; document.getElementById('actionform').submit(); } function toggle(elementId) { $("#" + elementId).toggle(); } [{/capture}] [{oxscript add=$smarty.capture.javascripts}]
[{oxmultilang ident="D3_TOTP_QRCODE_HELP"}]
[{oxmultilang ident="D3_TOTP_SECRET_HELP"}]
[{oxmultilang ident="D3_TOTP_CURROTP_HELP"}]
[{/block}] *}] [{/capture}] [{capture append="oxidBlock_sidebar"}] [{include file="page/account/inc/account_menu.tpl" active_link="d3webauthn"}] [{/capture}] [{include file="layout/page.tpl" sidebar="Left"}]