Skip to content

Commit

Permalink
sendMessage -> sendMessageUp
Browse files Browse the repository at this point in the history
  • Loading branch information
r-n-o committed Oct 10, 2023
1 parent 2a2efb6 commit c498113
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h2>Message log</h2>
var targetPubBuf = await p256JWKPrivateToPublic(embeddedKeyJwk);
var targetPubHex = bufferToHexString(targetPubBuf);
document.getElementById("embedded-key").value = targetPubHex;
sendMessage("PUBLIC_KEY_READY", targetPubHex)
sendMessageUp("PUBLIC_KEY_READY", targetPubHex)

// 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.
Expand Down Expand Up @@ -194,7 +194,7 @@ <h2>Message log</h2>
});

RECOVERY_CREDENTIAL_BYTES = recoveryCredentialBytes;
sendMessage("BUNDLE_INJECTED", true)
sendMessageUp("BUNDLE_INJECTED", true)
}
/**
* Function triggered when STAMP_REQUEST event is received.
Expand Down Expand Up @@ -234,15 +234,15 @@ <h2>Message log</h2>
};

var stampHeaderValue = stringToBase64urlString(JSON.stringify(stamp));
sendMessage("STAMP", stampHeaderValue)
sendMessageUp("STAMP", stampHeaderValue)
}

/**
* Function to send a message. If this page is embedded as an iframe we'll use window.top.postMessage. Otherwise we'll display it in the DOM.
* @param type message type. Can be "PUBLIC_KEY_CREATED", "BUNDLE_INJECTED" or "STAMP"
* @param value message value
*/
var sendMessage = function(type, value) {
var sendMessageUp = function(type, value) {
if (window.top !== null) {
window.top.postMessage({
"type": type,
Expand Down

0 comments on commit c498113

Please sign in to comment.