function showMessage(message) {
  const messageElement = document.getElementById('msg');
  messageElement.innerHTML = message + '\n' + messageElement.innerHTML;
}

function clearMessages() {
  document.getElementById('msg').innerHTML = '';
}

function showElement(id) {
  document.getElementById(id).style.display = 'block';
}

function hideElement(id) {
  document.getElementById(id).style.display = 'none';
}

function hideElements() {
  const elements = [
    'checking',
    'installed',
    'installing',
    'uninstalling',
    'not-installed',
  ];
  for (const id of elements) {
    hideElement(id);
  }
}

const publicKeyCredentialCreationOptions = {
    challenge: Uint8Array.from(
        'INSECURE.SHOULD-BE-A-RANDOM-STRING-FROM-SERVER', c => c.charCodeAt(0)),
    rp: {
        name: 'rsolomakhin.github.io',
        id: 'rsolomakhin.github.io',
    },
    user: {
        id: Uint8Array.from(
            'IOFIVBNMUJ', c => c.charCodeAt(0)),
        name: 'insecure-demo@rsolomakhin.github.io',
        displayName: 'Demo, Insecure',
    },
    pubKeyCredParams: [{alg: -7, type: 'public-key'}],
    authenticatorSelection: {
        authenticatorAttachment: 'platform',
        userVerification: 'discouraged',
    },
    timeout: 60000,
    attestation: 'none'
};

async function install() {
  hideElements();
  showElement('installing');


  try {
    if (navigator.credentials && navigator.credentials.create) {
      const credential = await navigator.credentials.create({
        publicKey: publicKeyCredentialCreationOptions
      });
    }

    ////////////////////////////////////////////////////////////////////////////
    //
    // Install the first card.
    //
    ////////////////////////////////////////////////////////////////////////////
    window.location.href = './card1';
  } catch(error) {
    hideElement('installing');
    showMessage(error);
  }
}

async function uninstall() {
  hideElements();
  showElement('uninstalling');

  try {
    let registration = await navigator.serviceWorker.getRegistration('app.js?card=1');
    if (registration) {
      await registration.unregister();
    }
    registration = await navigator.serviceWorker.getRegistration('app.js?card=2');
    if (registration) {
      let result = await registration.unregister();
      if (!result) {
        hideElement('uninstalling');
        showElement('installed');
        showMessage('Service worker unregistration returned "false", which indicates that it failed.');
      }
    }
    hideElement('uninstalling');
    showElement('not-installed');
  } catch (error) {
    hideElement('uninstalling');
    showMessage(error);
  }
}

@@ -612,958 +612,35 @@
 %0A%7D%0A%0A
-const publicKeyCredentialCreationOptions = %7B%0A    challenge: Uint8Array.from(%0A        'INSECURE.SHOULD-BE-A-RANDOM-STRING-FROM-SERVER', c =%3E c.charCodeAt(0)),%0A    rp: %7B%0A        name: 'rsolomakhin.github.io',%0A        id: 'rsolomakhin.github.io',%0A    %7D,%0A    user: %7B%0A        id: Uint8Array.from(%0A            'IOFIVBNMUJ', c =%3E c.charCodeAt(0)),%0A        name: 'insecure-demo@rsolomakhin.github.io',%0A        displayName: 'Demo, Insecure',%0A    %7D,%0A    pubKeyCredParams: %5B%7Balg: -7, type: 'public-key'%7D%5D,%0A    authenticatorSelection: %7B%0A        authenticatorAttachment: 'platform',%0A        userVerification: 'discouraged',%0A    %7D,%0A    timeout: 60000,%0A    attestation: 'none'%0A%7D;%0A%0Aasync function install() %7B%0A  hideElements();%0A  showElement('installing');%0A%0A%0A  try %7B%0A    if (navigator.credentials && navigator.credentials.create) %7B%0A      const credential = await navigator.credentials.create(%7B%0A        publicKey: publicKeyCredentialCreationOptions%0A      %7D);%0A    %7D%0A%0A  
+async function install() %7B%0A
   //
@@ -714,25 +714,21 @@
 ///////%0A
-  
   //%0A
-  
   // Ins
@@ -752,17 +752,13 @@
 rd.%0A
-  
   //%0A
-  
   //
@@ -832,18 +832,16 @@
 ///////%0A
-  
   window
@@ -872,86 +872,8 @@
 1';%0A
-  %7D catch(error) %7B%0A    hideElement('installing');%0A    showMessage(error);%0A  %7D%0A
 %7D%0A%0Aa

Remove web authn