Registering a new Authorization with WebAuthn

In our HTML, let's add some code in the account view

<section id="webauthn">
    <button onclick="Auth.addWebAuthn()">Add Authenticator / Passkey</button>
</section>

Then in Auth.js we add

addWebAuthn: async () => {           
    const options = await API.webAuthn.registrationOptions();        
    options.authenticatorSelection.residentKey = 'required';
    options.authenticatorSelection.requireResidentKey = true;
    options.extensions = {
        credProps: true,
    };
    const authRes = await SimpleWebAuthnBrowser.startRegistration(options);
    const verificationRes = await API.webAuthn.registrationVerification(authRes);
    if (verificationRes.ok) {
        alert("You can now login using the registered method!");
    } else {
        alert(verificationRes.message)
    }
},