(() => { const SOURCE = "peach-firefox-sender-probe"; document.documentElement.dataset.peachFirefoxSenderProbe = "ready"; // Proves Firefox injected this content script before the page probe runs. const ALLOWED_TYPES = new Set(["GET_ENTRIES", "GET_RECOVERY_WORDS", "GET_SETTINGS"]); window.addEventListener("message", async (event) => { let request; try { request = JSON.parse(event.data); } catch { return; } const { id, message } = request ?? {}; if (request?.source !== SOURCE || typeof id !== "string" || !message) return; let response; try { response = message.type === "STORAGE_SESSION" ? await chrome.storage.session.get("peach_session_dk") : ALLOWED_TYPES.has(message.type) ? await chrome.runtime.sendMessage(message) : undefined; if (response === undefined) return; } catch (error) { response = { ok: false, error: String(error) }; } window.postMessage(JSON.stringify({ source: `${SOURCE}:response`, id, response }), "*"); }); })();