Skip to content

Commit

Permalink
add public key event to standalone mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivia Thet committed Feb 26, 2024
1 parent e3fe741 commit 9fd580f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions import/standalone.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ <h2>Message log</h2>
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) {
Expand Down

0 comments on commit 9fd580f

Please sign in to comment.