// TODO: this should be bundled at build time or replaced with code written by Turnkey entirely.
import * as hpke from "https://esm.sh/@hpke/core";
import * as ed from "https://esm.sh/@noble/ed25519";
+ import { sha512 } from 'https://esm.sh/@noble/hashes/sha512';
+
+ ed.etc.sha512Sync = (...m) => sha512(ed.etc.concatBytes(...m));
document.addEventListener("DOMContentLoaded", async () => {
await TKHQ.initEmbeddedKey();
@@ -465,9 +465,9 @@
Message log
// We do not want to arbitrarily receive messages from all origins.
window.addEventListener("message", async function(event) {
if (event.data && event.data["type"] == "INJECT_KEY_EXPORT_BUNDLE") {
- TKHQ.logMessage(`⬇️ Received message ${event.data["type"]}: ${event.data["value"]}, ${event.data["keyFormat"]}, ${event.data["publicKey"]}`);
+ TKHQ.logMessage(`⬇️ Received message ${event.data["type"]}: ${event.data["value"]}, ${event.data["keyFormat"]}`);
try {
- await onInjectKeyBundle(event.data["value"], event.data["keyFormat"], event.data["publicKey"])
+ await onInjectKeyBundle(event.data["value"], event.data["keyFormat"])
} catch (e) {
TKHQ.sendMessageUp("ERROR", e.toString());
}
@@ -501,7 +501,6 @@