function parse_form_data(event) { const formData = new FormData(event.target); const json = {}; for (const [key, value] of formData.entries()) { json[key] = value; } return json; } async function computeSha256(message) { const msgUint8 = new TextEncoder().encode(message); const hashBuffer = await window.crypto.subtle.digest("SHA-256", msgUint8); const hashArray = Array.from(new Uint8Array(hashBuffer)); const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join(""); return hashHex; } function randStr() { return Math.floor(Math.random()*16777215).toString(16); }