(async () => { const box = document.getElementById("seal27"); if (!box) return; for (let i = 0; i < 100 && !window.zooSeal; i++) await new Promise((r) => setTimeout(r, 100)); const seal = window.zooSeal; if (!seal) { box.innerHTML = '

Card 26 did not start (see there).

'; return; } let stop = null; async function render(flash) { if (stop) { stop(); stop = null; } for (let i = 0; i < 100 && seal.status === "loading"; i++) await new Promise((r) => setTimeout(r, 100)); const st = seal.status; if (st === "nostorage" || st === "none" || st === "unsupported") { box.innerHTML = '

Seal a postcard first (26).

'; return; } if (st === "locked") { let code = "…"; try { code = await seal.request(); } catch (e) { code = ""; } box.innerHTML = '

This browser has never opened your postcard. On a device that has, type this code in card 27:

' + '

' + zoo.esc(code) + '

It works for 15 minutes. Waiting…

' + '

' + '

Storage opens in a small window; your recovery key is typed there, never here.

'; document.getElementById("seal-recover").onclick = async (ev) => { ev.target.disabled = true; document.getElementById("seal-rout").textContent = "in storage's window…"; try { await seal.useStorage(); window.zooSealRender && window.zooSealRender("Let in with your recovery key, in storage's window."); render(); } catch (e) { ev.target.disabled = false; document.getElementById("seal-rout").textContent = e.message; } }; stop = seal.poll((s) => { if (s === "ready") { window.zooSealRender && window.zooSealRender("Let in by a device that had the key."); render(); } }); return; } const devs = seal.devices.map((d) => '
  • ' + zoo.esc(d.name) + (d.mine ? ' this browser' : '') + ' ' + zoo.esc(d.via) + '
  • ').join(""); box.innerHTML = (flash ? '

    ' + zoo.esc(flash) + '

    ' : '') + '

    Open this page in a private window (or on another device), sign in, and type the code it shows here:

    ' + '

    ' + '

    Your devices that open the zoo\'s postcards:

    '; document.getElementById("seal-approve").onsubmit = async (ev) => { ev.preventDefault(); const out = document.getElementById("seal-aout"); out.textContent = "checking the code…"; try { const n = await seal.approve(document.getElementById("seal-code-in").value); render("Let in: " + n + "."); } catch (e) { out.textContent = e.message; } }; } render(); })();