const csrfToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MDQwMzY1Mjh9.UbpgiMr22i3HcsrX7UJwMMbquYPhQ1zGB4QGSFZMr1E'; // event subscribed by Verify Enclave window.addEventListener("message", (event) => { const attestationId = event.data const origin = event.origin if (!attestationId) return if (attestationId.length !== 64) return fetch(`${window.location.protocol}//${window.location.host}/attestation`, { method: "POST", body: JSON.stringify({ attestationId, origin }), headers: new Headers({ 'content-type': 'application/json', 'x-csrf-token': csrfToken }) }) }) // auto reload to refresh token window.addEventListener("load", async () => { setInterval(() => { window.location.reload() }, 60_000) }) // notify the SDK that the iframe is ready window.parent.postMessage("verify_ready", "*")