From 9fd580f14ffcf6881d4a01e2cae00537e4d92cfa Mon Sep 17 00:00:00 2001 From: Olivia Thet Date: Mon, 26 Feb 2024 14:14:16 -0500 Subject: [PATCH] add public key event to standalone mode --- import/standalone.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/import/standalone.html b/import/standalone.html index ef582e9..ce3be5f 100644 --- a/import/standalone.html +++ b/import/standalone.html @@ -234,6 +234,12 @@

Message log

import * as hpke from "https://esm.sh/@hpke/core"; document.addEventListener("DOMContentLoaded", async () => { + // This is a workaround for how the SDK's iframe stamper is initialized. Currently, + // init() waits for a public key to be initialized that can be used to send to the server + // which will encrypt messages to this public key. + // In the case of import, this public key is not used because the client encrypts messages + // to the server's public key. + TKHQ.sendMessageUp("PUBLIC_KEY_READY", "") // TODO: find a way to filter messages and ensure they're coming from the parent window? // We do not want to arbitrarily receive messages from all origins. window.addEventListener("message", async function(event) {