<!doctype html>
<head>
<title>Helper to create 'identity' credentials</title>
</head>
<script>
'use strict';

async function createCredentials() {
  await navigator.credentials.store(await navigator.credentials.create({
    identity: {
      id: "no-options",
    }
  }));

  await navigator.credentials.store(await navigator.credentials.create({
    identity: {
      id: "allow-alt",
      effectiveOrigins: ["https://{{hosts[alt][]}}:{{ports[https][0]}}"],
    }
  }));

  await navigator.credentials.store(await navigator.credentials.create({
    identity: {
      id: "allow-primary",
      effectiveOrigins: ["https://{{hosts[][]}}:{{ports[https][0]}}"],
    }
  }));

  await navigator.credentials.store(await navigator.credentials.create({
    identity: {
      id: "allow-cors-success",
      effectiveQueryURL: [`${window.origin}/_mozilla/credential-management/support/cors.py`]
    }
  }));

  await navigator.credentials.store(await navigator.credentials.create({
    identity: {
      id: "allow-cors-failure",
      effectiveQueryURL: [`${window.origin}/_mozilla/credential-management/support/no-cors.py`]
    }
  }));
}

createCredentials().then(() => {
  window.opener.postMessage("created", "*");
})

</script>
