PageSourceSearch

https://www.hearth.com/talk/js/xf/webauthn.min.js?_v=cbfe0637

js hearth.com collected 2026-10-02 04:28:56 UTC 5,712 bytes, 12 lines download raw bytes

1((k,l)=>{XF.WebAuthn=XF.Element.newHandler({options:{startButton:".js-webauthnStart",verifying:null,type:"create",rpName:"",rpId:location.hostname,userId:0,userName:"",userDisplayName:"",userVerification:"discouraged",residentKey:"preferred",existingCredentials:[],authAttachment:null,timeout:6E4,attestation:"none",autotrigger:!1,autosubmit:!1},target:null,form:null,challenge:null,init(){this.form=this.target.closest("form");this.challenge=this.form.querySelector('input[name="webauthn_challenge"]').value;
2this.options.autotrigger&&this.initWebAuthn();let a=this.target.querySelector(this.options.startButton);a&&a.addEventListener("click",d=>{this.initWebAuthn()})},initWebAuthn(){"create"===this.options.type?this.typeCreate():"get"===this.options.type&&this.typeGet()},typeCreate(){let a=this.form.querySelector(".formSubmitRow button");a.classList.add("is-disabled");a.disabled=!0;XF.WebAuthnProcess.create({challenge:this.challenge,target:this.target,config:this.options,registerFn:this.registerCredentials.bind(this),
3errorFn:this.resetFormState.bind(this)})},typeGet(){var a=this.form.querySelector(".formSubmitRow button");null!==a&&(a.classList.add("is-disabled"),a.disabled=!0);a=this.target;const d=this.options;d.allow=[];this.options.existingCredentials.forEach(c=>{d.allow.push({id:Uint8Array.from(atob(c),e=>e.charCodeAt(0)),type:"public-key"})});XF.WebAuthnProcess.get({challenge:this.challenge,target:a,config:d,registerFn:this.registerCredentials.bind(this),errorFn:this.resetFormState.bind(this)})},resetFormState(){let a=
4this.form.querySelector(".formSubmitRow button");null!==a&&(a.classList.remove("is-disabled"),a.disabled=!1)},registerCredentials(a){this.form.querySelector('input[name="webauthn_payload"]').value=JSON.stringify(a);a=this.form.querySelector(".formSubmitRow button");null!==a&&(a.classList.remove("is-disabled"),a.disabled=!1)}});XF.WebAuthnClick=XF.Event.newHandler({eventNameSpace:"XFWebAuthnClick",options:{rpName:"",rpId:location.hostname,userId:0,userName:"",userDisplayName:"",userVerification:"discouraged",
5residentKey:"preferred",existingCredentials:[],authAttachment:null,timeout:6E4,attestation:"none",autotrigger:!1,autosubmit:!1},processing:!1,challenge:null,init(){this.target.classList.add("is-disabled")},click(a){a.preventDefault();this.processing||(this.processing=!0,this.initSetup())},initSetup(){const a=this.target;XF.ajax("get",this.target.href,({challenge:d,rpName:c,userId:e,userName:f,userDisplayName:b})=>{this.challenge=d;XF.WebAuthnProcess.create({challenge:d,target:a,config:{...this.options,
6rpName:c,userId:e,userName:f,userDisplayName:b},registerFn:this.registerCredentials.bind(this),errorFn:this.resetState.bind(this)})})},resetState(){this.processing=!1;this.target.classList.remove("is-disabled")},registerCredentials(a){XF.ajax("post",XF.canonicalizeUrl(("admin"===XF.getApp()?"admin.php?":"index.php?")+"account/passkey/add"),{webauthn_payload:JSON.stringify(a),webauthn_challenge:this.challenge,user_verification:this.options.userVerification},this.onSuccess.bind(this),{skipDefaultSuccess:!0})},
7onSuccess(a){this.processing=!1;this.target.classList.remove("is-disabled");"ok"===a.status&&a.redirect?a.message?XF.flashMessage(a.message,1E3,()=>XF.redirect(a.redirect)):XF.redirect(a.redirect):XF.alert("Unexpected response")}});XF.WebAuthnProcess=(()=>({create:({challenge:a,target:d,config:c,registerFn:e,errorFn:f})=>{c.userId=c.userId.toString();a={publicKey:{challenge:Uint8Array.from(a,b=>b.charCodeAt(0)),rp:{name:c.rpName,id:c.rpId},user:{id:Uint8Array.from(c.userId,b=>b.charCodeAt(0)),name:c.userName,
8displayName:c.userDisplayName},pubKeyCredParams:[{alg:-7,type:"public-key"},{alg:-8,type:"public-key"},{alg:-257,type:"public-key"}],authenticatorSelection:{userVerification:c.userVerification,residentKey:c.residentKey},timeout:c.timeout,attestation:c.attestation}};c.authAttachment&&(a.publicKey.authenticatorSelection.authenticatorAttachment=c.authAttachment);if(Array.isArray(c.existingCredentials)){let b=[];c.existingCredentials.forEach(function(g){b.push({id:Uint8Array.from(atob(g),h=>
8h.charCodeAt(0)),
9type:"public-key"})});a.publicKey.excludeCredentials=b}navigator.credentials.create(a).then(b=>{const g=b.response.attestationObject;e({clientDataJSON:b.response.clientDataJSON?btoa(String.fromCharCode(...(new Uint8Array(b.response.clientDataJSON)))):null,attestationObject:g?btoa(String.fromCharCode(...(new Uint8Array(g)))):null})}).then(()=>{c.autosubmit&&setTimeout(()=>{const b=d.closest("form");XF.trigger(b,"submit")&&b.submit()},500)}).catch(b=>{console.error(b);f&&f(b)})},get:({challenge:a,target:d,
10config:c,registerFn:e,errorFn:f})=>{a={publicKey:{challenge:Uint8Array.from(a,b=>b.charCodeAt(0)),allowCredentials:c.allow,userVerification:c.userVerification,timeout:c.timeout}};navigator.credentials.get(a).then(b=>{c.startButton&&(d.querySelector(c.startButton).classList.add("is-disabled"),d.querySelector(c.startButton).disabled=!0,d.querySelector(c.startButton).textContent=c.verifying);e({id:btoa(String.fromCharCode(...(new Uint8Array(b.rawId)))),authenticatorData:b.response.authenticatorData?
11btoa(String.fromCharCode(...(new Uint8Array(b.response.authenticatorData)))):null,clientDataJSON:b.response.clientDataJSON?btoa(String.fromCharCode(...(new Uint8Array(b.response.clientDataJSON)))):null,signature:b.response.signature?btoa(String.fromCharCode(...(new Uint8Array(b.response.signature)))):null})}).then(()=>{c.autosubmit&&setTimeout(()=>{const b=d.closest("form");XF.trigger(b,"submit")&&b.submit()},500)}).catch(b=>{console.error(b);f&&f(b)})}}))();XF.Element.register("webauthn","XF.WebAuthn");
12XF.Event.register("click","webauthn-click","XF.WebAuthnClick")})(window,document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.