} JSON stringified encrypted bundle with encappedPublic and ciphertext\n */\nexport async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) {\n const kemContext = new DhkemP256HkdfSha256();\n const receiverPub = await kemContext.importKey(\n \"jwk\",\n { ...receiverPubJwk },\n true\n );\n\n const suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n const senderCtx = await suite.createSenderContext({\n recipientPublicKey: receiverPub,\n info: TURNKEY_HPKE_INFO,\n });\n\n // Need to import the key again as a JWK to export as a raw key, the format needed to\n // create the aad with the newly generated raw encapped key.\n const receiverPubCryptoKey = await crypto.subtle.importKey(\n \"jwk\",\n receiverPubJwk,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n const receiverPubRaw = await crypto.subtle.exportKey(\n \"raw\",\n receiverPubCryptoKey\n );\n const receiverPubBuf = new Uint8Array(receiverPubRaw);\n\n const encappedKeyBuf = new Uint8Array(senderCtx.enc);\n\n const aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n\n var ciphertextBuf;\n try {\n ciphertextBuf = await senderCtx.seal(plaintextBuf, aad);\n } catch (e) {\n throw new Error(\"failed to encrypt import bundle: \" + e.toString());\n }\n\n const ciphertextHex = uint8arrayToHexString(new Uint8Array(ciphertextBuf));\n const encappedKeyBufHex = uint8arrayToHexString(encappedKeyBuf);\n const encryptedBundle = JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n return encryptedBundle;\n}\n","// This file is the main entrypoint of the webpack-bundled application\n\n// Import relevant modules\nimport { TKHQ } from \"./turnkey-core.js\";\nimport { initEventHandlers } from \"./event-handlers.js\";\nimport { HpkeDecrypt } from \"@shared/crypto-utils.js\";\nimport \"./styles.css\";\n\n// Surface TKHQ for external access\nwindow.TKHQ = TKHQ;\n\n// Init app\ndocument.addEventListener(\"DOMContentLoaded\", async function () {\n await TKHQ.initEmbeddedKey();\n const embeddedKeyJwk = await TKHQ.getEmbeddedKey();\n const targetPubBuf = await TKHQ.p256JWKPrivateToPublic(embeddedKeyJwk);\n const targetPubHex = TKHQ.uint8arrayToHexString(targetPubBuf);\n document.getElementById(\"embedded-key\").value = targetPubHex;\n\n initEventHandlers(HpkeDecrypt);\n\n // If styles are saved in local storage, sanitize and apply them\n const styleSettings = TKHQ.getSettings();\n if (styleSettings) {\n TKHQ.applySettings(styleSettings);\n }\n\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", targetPubHex);\n});\n","module.exports = crypto;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"bundle.\" + {\"291\":\"3eaea85f4001b9cc63c3\",\"825\":\"aaba32bf7338e3d0f1cc\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","__webpack_require__.p = \"/\";","\n__webpack_require__.sriHashes = {\"291\":\"*-*-*-CHUNK-SRI-HASH-r3NPGwA4ft5fHgGXhVIptCiDVf06qPa+sxzG6L+8GwPuhn89e/\",\"825\":\"*-*-*-CHUNK-SRI-HASH-mfog3UJdGPOmSk4QZbKxsxHPFZtt298WnZNc1aQ1MCgc6YirFj\"};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t792: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkexport_and_sign\"] = self[\"webpackChunkexport_and_sign\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96], () => (__webpack_require__(560)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","_toConsumableArray","Array","isArray","_arrayLikeToArray","_arrayWithoutHoles","from","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","toString","slice","constructor","name","test","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","TURNKEY_EMBEDDED_KEY","TURNKEY_SETTINGS","parentFrameMessageChannelPort","getSubtleCrypto","globalThis","crypto","subtle","window","global","isDoublyIframed","undefined","location","ancestorOrigins","parent","top","_loadQuorumKey","_callee","quorumPublic","_context","Error","importKey","namedCurve","_initEmbeddedKey","_callee3","_context3","getEmbeddedKey","generateTargetKey","setEmbeddedKey","_generateTargetKey","_callee4","p256key","_context4","generateKey","exportKey","privateKey","jwtKey","getItemWithExpiry","JSON","parse","targetKey","setItemWithExpiry","stringify","key","ttl","item","expiry","Date","getTime","localStorage","setItem","itemStr","getItem","hasOwnProperty","removeItem","uint8arrayFromHexString","hexString","hexWithoutPrefix","startsWith","Uint8Array","match","map","h","parseInt","uint8arrayToHexString","buffer","x","padStart","join","additionalAssociatedData","senderPubBuf","receiverPubBuf","s","concat","logMessage","content","messageLog","document","getElementById","message","createElement","innerText","appendChild","p256JWKPrivateToPublic","_x6","_p256JWKPrivateToPublic","_callee6","jwkPrivate","jwkPrivateCopy","publicKey","_context6","_objectSpread","key_ops","base58Encode","bytes","result","digits","carry","j","push","k","base58Decode","alphabet","decodedBytes","leadingZeros","indexOf","currentByte","reverse","_encodeKey","_callee9","privateKeyBytes","keyFormat","publicKeyBytes","concatenatedBytes","_t2","_context9","set","console","warn","sharedInitEmbeddedKey","SharedTKHQ","validateStyles","styles","element","validStyles","cssValidationRegex","padding","margin","borderWidth","borderStyle","borderColor","borderRadius","fontSize","fontWeight","fontFamily","color","labelColor","backgroundColor","width","height","maxWidth","maxHeight","lineHeight","boxShadow","textAlign","overflowWrap","wordWrap","resize","entries","forEach","_ref","_ref2","_arrayWithHoles","next","_iterableToArrayLimit","_nonIterableRest","property","styleProperty","trim","styleRegexStr","styleRegex","RegExp","styleValue","loadQuorumKey","_x","_verifyEnclaveSignature","_callee2","enclaveQuorumPublic","publicSignature","signedData","TURNKEY_SIGNERS_ENCLAVES","environment","meta","TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY","encryptionQuorumPublicBuf","quorumKey","publicSignatureBuf","signedDataBuf","_context2","prod","preprod","querySelector","__TURNKEY_SIGNER_ENVIRONMENT__","fromDerSignature","verify","hash","TKHQ","initEmbeddedKey","onResetEmbeddedKey","encodeKey","_x0","_x1","_x10","sendMessageUp","type","requestId","postMessage","setParentFrameMessageChannelPort","port","normalizePadding","byteArray","targetLength","paddingLength","fill","expectedZeroCount","zeroCount","verifyEnclaveSignature","_x2","_x3","getEd25519PublicKey","privateKeyHex","nobleEd25519","sha512Sync","_nobleEd25519$etc","nobleHashes","concatBytes","applySettings","settings","validSettings","settingsObj","keyDivTextarea","style","getSettings","setSettings","parsePrivateKey","error","_slicedToArray","inMemoryKeys","injectedEmbeddedKey","textEncoder","TextEncoder","textDecoder","TextDecoder","verifyAndParseBundleData","_verifyAndParseBundleData","_callee8","bundle","organizationId","bundleObj","_context8","version","data","dataSignature","decode","encappedPublic","ciphertext","decryptBundle","_x4","_x5","_decryptBundle","HpkeDecrypt","encappedKeyBuf","ciphertextBuf","receiverPrivJwk","_t9","onGetPublicEmbeddedKey","_onGetPublicEmbeddedKey","_callee0","embeddedKeyJwk","targetPubBuf","targetPubHex","_context0","loadKeyIntoMemory","_x7","_x8","_x9","_loadKeyIntoMemory","_callee1","address","keyBytes","keyAddress","cachedKeypair","_context1","subarray","Keypair","fromSecretKey","createSolanaKeypair","_defineProperty","format","keypair","onInjectKeyBundle","_x11","_x12","_x13","_x14","_onInjectKeyBundle","_callee10","_context10","onApplySettings","_x15","_x16","_onApplySettings","_callee11","_context11","onSignTransaction","_x17","_x18","_x19","_onSignTransaction","_callee12","serializedTransaction","transactionWrapper","transactionToSign","signedTransaction","transactionBytes","transaction","signedTransactionHex","_context12","validateKey","getOrCreateKeypair","VersionedTransaction","deserialize","sign","serialize","onSignMessage","_x20","_x21","_x22","_onSignMessage","_callee13","serializedMessage","messageWrapper","messageToSign","messageType","messageBytes","signatureHex","signature","_context13","encode","secretKey","onClearEmbeddedPrivateKey","_x23","_x24","_onClearEmbeddedPrivateKey","_callee14","_context14","onSetEmbeddedKeyOverride","_x25","_x26","_x27","_x28","_onSetEmbeddedKeyOverride","_callee15","keyJwk","_context15","rawP256PrivateKeyToJwk","onResetToDefaultEmbeddedKey","_x29","_createSolanaKeypair","_callee16","_context16","fromSeed","_x30","_rawP256PrivateKeyToJwk","_callee17","rawPrivateKeyBytes","pkcs8Prefix","pkcs8","cryptoKey","_context17","clearExpiredKey","now","addressesToRemove","_i","_Object$entries","_Object$entries$_i","_i2","_addressesToRemove","clearAllExpiredKeys","getKeyNotFoundErrorMessage","_x31","_getOrCreateKeypair","_callee18","_context18","initEventHandlers","messageEventListener","_messageEventListener","event","_t","_t3","_t4","_t5","_t6","_t7","_t8","_x37","initMessageEventListener","messageListenerController","AbortController","turnkeyInitController","addEventListener","preventDefault","_x32","_x33","_ref3","_x34","_ref4","_x35","injectWalletBtn","_ref5","_callee5","_context5","_x36","addDOMEventListeners","capture","signal","_ref6","_callee7","_event$ports","iframeMessagePort","_context7","ports","abort","onmessage","origin","_x38","ownKeys","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","getOwnPropertyDescriptors","defineProperties","_typeof","toPrimitive","String","_toPrimitive","_toPropertyKey","TURNKEY_HPKE_INFO","_HpkeDecrypt","kemContext","receiverPriv","suite","recipientCtx","aad","res","DhkemP256HkdfSha256","CipherSuite","kem","kdf","HkdfSha256","aead","Aes256Gcm","createRecipientContext","recipientKey","enc","info","open","styleSettings","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","id","loaded","__webpack_modules__","O","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","every","splice","getter","__esModule","obj","mode","this","ns","def","current","getOwnPropertyNames","definition","get","chunkId","all","reduce","promises","miniCssF","g","Function","prop","url","script","needAttach","scripts","getElementsByTagName","getAttribute","charset","nc","setAttribute","src","crossOrigin","integrity","sriHashes","onScriptComplete","prev","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","target","head","nmd","paths","children","installedChunks","installedChunkData","promise","reject","errorType","realSrc","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""}
\ No newline at end of file
diff --git a/export-and-sign/dist/index.html b/export-and-sign/dist/index.html
index bbca992..456ed13 100644
--- a/export-and-sign/dist/index.html
+++ b/export-and-sign/dist/index.html
@@ -1 +1 @@
-Turnkey Export Export Key Material This public key will be sent along with a private key ID or wallet ID inside of a new EXPORT_PRIVATE_KEY or EXPORT_WALLET activity
Inject Key Export Bundle The export bundle comes from the parent page and is composed of a public key and an encrypted payload. The payload is encrypted to this document's embedded key (stored in local storage and displayed above). The scheme relies on HPKE (RFC 9180) .
Inject Wallet Export Bundle The export bundle comes from the parent page and is composed of a public key and an encrypted payload. The payload is encrypted to this document's embedded key (stored in local storage and displayed above). The scheme relies on HPKE (RFC 9180) .
Sign Transaction Input a serialized transaction to sign.
Sign Message Input a serialized message to sign.
Message log Below we display a log of the messages sent / received. The forms above send messages, and the code communicates results by sending events via the postMessage API.
\ No newline at end of file
+Turnkey Export Export Key Material This public key will be sent along with a private key ID or wallet ID inside of a new EXPORT_PRIVATE_KEY or EXPORT_WALLET activity
Inject Key Export Bundle The export bundle comes from the parent page and is composed of a public key and an encrypted payload. The payload is encrypted to this document's embedded key (stored in local storage and displayed above). The scheme relies on HPKE (RFC 9180) .
Inject Wallet Export Bundle The export bundle comes from the parent page and is composed of a public key and an encrypted payload. The payload is encrypted to this document's embedded key (stored in local storage and displayed above). The scheme relies on HPKE (RFC 9180) .
Sign Transaction Input a serialized transaction to sign.
Sign Message Input a serialized message to sign.
Message log Below we display a log of the messages sent / received. The forms above send messages, and the code communicates results by sending events via the postMessage API.
\ No newline at end of file
diff --git a/export-and-sign/index.test.js b/export-and-sign/index.test.js
index 74d0f47..5de7117 100644
--- a/export-and-sign/index.test.js
+++ b/export-and-sign/index.test.js
@@ -10,6 +10,7 @@ import {
getKeyNotFoundErrorMessage,
onResetToDefaultEmbeddedKey,
onSetEmbeddedKeyOverride,
+ initEventHandlers,
} from "./src/event-handlers.js";
jest.mock("@solana/web3.js", () => {
@@ -1154,3 +1155,190 @@ describe("Embedded Key Override", () => {
});
});
});
+
+// Minimal HTML supplying the DOM elements that initEventHandlers() requires.
+const MINIMAL_INIT_HTML = `
+
+
+
+
+
+`;
+
+describe("Channel Establishment Guard", () => {
+ /**
+ * These tests verify that the channelEstablished flag prevents a second
+ * concurrent TURNKEY_INIT_MESSAGE_CHANNEL message from establishing a
+ * second message channel.
+ *
+ * The race is possible because the handler is async: after the synchronous
+ * preamble runs, execution yields at `await TKHQ.initEmbeddedKey(...)`.
+ * Without the flag, a second message dispatched before that await resolves
+ * would pass the outer `if` check and set up a second channel.
+ *
+ * With the fix, channelEstablished is set to true synchronously (before
+ * the first await), so any concurrent invocation returns immediately.
+ */
+
+ let dom;
+ let TKHQModule;
+
+ beforeEach(async () => {
+ dom = new JSDOM(MINIMAL_INIT_HTML, { url: "http://localhost" });
+
+ global.window = dom.window;
+ global.document = dom.window.document;
+ global.localStorage = dom.window.localStorage;
+ global.TextEncoder = TextEncoder;
+ global.TextDecoder = TextDecoder;
+ global.crypto = crypto.webcrypto;
+
+ // initEventHandlers() calls `new AbortController()` and passes the resulting
+ // signal to window.addEventListener(). JSDOM validates that the signal is an
+ // instance of *its own* AbortSignal, not Node's native one. Shadow the global
+ // so that signals created inside initEventHandlers() are recognised by JSDOM.
+ global.AbortController = dom.window.AbortController;
+
+ const module = await import("./src/turnkey-core.js");
+ TKHQModule = module.TKHQ;
+
+ jest.spyOn(TKHQModule, "sendMessageUp").mockImplementation(() => {});
+ jest
+ .spyOn(TKHQModule, "setParentFrameMessageChannelPort")
+ .mockImplementation(() => {});
+ jest.spyOn(TKHQModule, "initEmbeddedKey").mockResolvedValue(undefined);
+ jest
+ .spyOn(TKHQModule, "getEmbeddedKey")
+ .mockReturnValue({ kty: "EC", crv: "P-256" });
+ jest
+ .spyOn(TKHQModule, "p256JWKPrivateToPublic")
+ .mockResolvedValue(new Uint8Array(65).fill(0x04));
+ jest.spyOn(TKHQModule, "uint8arrayToHexString").mockReturnValue("aabbccdd");
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ delete global.window;
+ delete global.document;
+ delete global.localStorage;
+ delete global.crypto;
+ delete global.AbortController;
+ });
+
+ /**
+ * Build a MessageEvent that looks like what iframe-stamper sends.
+ * Uses a plain mock object for the port — JSDOM's MessageEvent accepts it,
+ * and the handler only needs ports[0] to be truthy and to have an onmessage
+ * property (TKHQ.setParentFrameMessageChannelPort is mocked anyway).
+ */
+ function makeInitEvent(origin = "https://app.turnkey.com") {
+ const port = { onmessage: null, postMessage: jest.fn() };
+ const event = new dom.window.MessageEvent("message", {
+ data: { type: "TURNKEY_INIT_MESSAGE_CHANNEL" },
+ ports: [port],
+ origin,
+ });
+ return { event, port };
+ }
+
+ it("processes a single TURNKEY_INIT_MESSAGE_CHANNEL and sends PUBLIC_KEY_READY", async () => {
+ initEventHandlers(jest.fn());
+
+ const { event } = makeInitEvent();
+ dom.window.dispatchEvent(event);
+
+ // Allow the async handler to finish
+ await new Promise((resolve) => setTimeout(resolve, 0));
+
+ expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1);
+ expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledTimes(
+ 1
+ );
+ expect(TKHQModule.sendMessageUp).toHaveBeenCalledWith(
+ "PUBLIC_KEY_READY",
+ "aabbccdd"
+ );
+ });
+
+ it("ignores a second TURNKEY_INIT_MESSAGE_CHANNEL dispatched while the first is still pending", async () => {
+ /**
+ * This is the core race-condition test.
+ *
+ * Sequence of events:
+ * 1. event1 is dispatched. The handler runs synchronously up to
+ * `await TKHQ.initEmbeddedKey()`, setting channelEstablished = true
+ * before yielding.
+ * 2. event2 is dispatched while the first handler is still suspended.
+ * The handler finds channelEstablished === true and returns immediately.
+ * 3. The first handler resumes and completes normally.
+ *
+ * Without the fix (no channelEstablished flag), both handlers would
+ * proceed past the if-check and initEmbeddedKey would be called twice.
+ */
+ initEventHandlers(jest.fn());
+
+ const { event: event1, port: port1 } = makeInitEvent(
+ "https://app.turnkey.com"
+ );
+ const { event: event2, port: port2 } = makeInitEvent(
+ "https://malicious.example.com"
+ );
+
+ // Dispatch both before any awaited work completes.
+ dom.window.dispatchEvent(event1);
+ dom.window.dispatchEvent(event2);
+
+ await new Promise((resolve) => setTimeout(resolve, 0));
+
+ // Only the first message should have been handled.
+ expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1);
+ expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledTimes(
+ 1
+ );
+ expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledWith(
+ port1
+ );
+ expect(
+ TKHQModule.setParentFrameMessageChannelPort
+ ).not.toHaveBeenCalledWith(port2);
+ expect(TKHQModule.sendMessageUp).toHaveBeenCalledTimes(1);
+ expect(TKHQModule.sendMessageUp).toHaveBeenCalledWith(
+ "PUBLIC_KEY_READY",
+ "aabbccdd"
+ );
+ });
+
+ it("ignores a second TURNKEY_INIT_MESSAGE_CHANNEL even after the first has fully completed", async () => {
+ /**
+ * Even if the second message arrives after the first handler finishes
+ * (e.g. a delayed retry from a malicious frame), it must still be rejected.
+ * The channelEstablished flag persists for the lifetime of the page load.
+ */
+ initEventHandlers(jest.fn());
+
+ const { event: event1 } = makeInitEvent("https://app.turnkey.com");
+ const { event: event2, port: port2 } = makeInitEvent(
+ "https://malicious.example.com"
+ );
+
+ dom.window.dispatchEvent(event1);
+ await new Promise((resolve) => setTimeout(resolve, 0));
+
+ // First handler is now fully done.
+ expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1);
+
+ // Late second message.
+ dom.window.dispatchEvent(event2);
+ await new Promise((resolve) => setTimeout(resolve, 0));
+
+ // Nothing new should have happened.
+ expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1);
+ expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledTimes(
+ 1
+ );
+ expect(
+ TKHQModule.setParentFrameMessageChannelPort
+ ).not.toHaveBeenCalledWith(port2);
+ expect(TKHQModule.sendMessageUp).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/export-and-sign/src/event-handlers.js b/export-and-sign/src/event-handlers.js
index ba7f797..b51632e 100644
--- a/export-and-sign/src/event-handlers.js
+++ b/export-and-sign/src/event-handlers.js
@@ -754,6 +754,9 @@ export function initEventHandlers(HpkeDecrypt) {
signal: messageListenerController.signal,
});
+ // Guard to prevent concurrent channel establishment from multiple senders
+ let channelEstablished = false;
+
// Handle MessageChannel initialization for iframe communication
window.addEventListener(
"message",
@@ -769,6 +772,15 @@ export function initEventHandlers(HpkeDecrypt) {
event.data["type"] == "TURNKEY_INIT_MESSAGE_CHANNEL" &&
event.ports?.[0]
) {
+ // Synchronously check-and-set the flag before any await. This prevents
+ // a second concurrent invocation from racing through while the first is
+ // suspended at an await, which would allow multiple origins to establish
+ // a channel before turnkeyInitController.abort() is reached.
+ if (channelEstablished) {
+ return;
+ }
+ channelEstablished = true;
+
// remove the message event listener that was added in the DOMContentLoaded event
messageListenerController.abort();
diff --git a/export/index.template.html b/export/index.template.html
index 3fc8233..388ea78 100644
--- a/export/index.template.html
+++ b/export/index.template.html
@@ -1237,6 +1237,9 @@ Message log
const messageListenerController = new AbortController();
const turnkeyInitController = new AbortController();
+ // Guard to prevent concurrent channel establishment from multiple senders
+ let channelEstablished = false;
+
/**
* DOM Event handlers to power the export flow in standalone mode
* Instead of receiving events from the parent page, forms trigger them.
@@ -1377,6 +1380,15 @@ Message log
event.data["type"] == "TURNKEY_INIT_MESSAGE_CHANNEL" &&
event.ports?.[0]
) {
+ // Synchronously check-and-set the flag before any await. This prevents
+ // a second concurrent invocation from racing through while the first is
+ // suspended at an await, which would allow multiple origins to establish
+ // a channel before turnkeyInitController.abort() is reached.
+ if (channelEstablished) {
+ return;
+ }
+ channelEstablished = true;
+
// remove the message event listener that was added in the DOMContentLoaded event
messageListenerController.abort();
diff --git a/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js b/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js
new file mode 100644
index 0000000..8fd39dd
--- /dev/null
+++ b/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js
@@ -0,0 +1,3 @@
+/*! For license information please see index.bundle.5f5e5ca1b811d13b75e8.js.LICENSE.txt */
+(()=>{"use strict";var e,t,r,n,a,o={954:(e,t,r)=>{var n=r(482),a=r(584);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(){var e=p(),t=e.m(i),r=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function n(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===r||"GeneratorFunction"===(t.displayName||t.name))}var a={throw:1,return:2,break:3,continue:3};function o(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,a[e],t)},delegateYield:function(e,a,o){return t.resultName=a,r(n.d,u(e),o)},finish:function(e){return r(n.f,e)}},r=function(e,r,a){n.p=t.prev,n.n=t.next;try{return e(r,a)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(i=function(){return{wrap:function(t,r,n,a){return e.w(o(t),r,n,a&&a.reverse())},isGeneratorFunction:n,mark:e.m,awrap:function(e,t){return new v(e,t)},AsyncIterator:d,async:function(e,t,r,a,i){return(n(t)?f:s)(o(e),t,r,a,i)},keys:c,values:u}})()}function u(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(o(e)+" is not iterable")}function c(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function s(e,t,r,n,a){var o=f(e,t,r,n,a);return o.next().then(function(e){return e.done?e.value:o.next()})}function f(e,t,r,n,a){return new d(p().w(e,t,r,n),a||Promise)}function d(e,t){function r(n,a,o,i){try{var u=e[n](a),c=u.value;return c instanceof v?t.resolve(c.v).then(function(e){r("next",e,o,i)},function(e){r("throw",e,o,i)}):t.resolve(c).then(function(e){u.value=e,o(u)},function(e){return r("throw",e,o,i)})}catch(e){i(e)}}var n;this.next||(l(d.prototype),l(d.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),l(this,"_invoke",function(e,a,o){function i(){return new t(function(t,n){r(e,o,t,n)})}return n=n?n.then(i,i):i()},!0)}function p(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return l(s,"_invoke",function(r,n,a){var o,u,c,s=0,f=a||[],d=!1,p={p:0,n:0,v:e,a:l,f:l.bind(e,4),d:function(t,r){return o=t,u=0,c=e,p.n=r,i}};function l(r,n){for(u=r,c=n,t=0;!d&&s&&!a&&t3?(a=v===n)&&(c=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=l&&((a=r<2&&ln||n>v)&&(o[4]=r,o[5]=n,p.n=v,u=0))}if(a||r>1)return i;throw d=!0,n}return function(a,f,v){if(s>1)throw TypeError("Generator is already running");for(d&&1===f&&l(f,v),u=f,c=v;(t=u<2?e:c)||!d;){o||(u?u<3?(u>1&&(p.n=-1),l(u,c)):p.n=c:p.v=c);try{if(s=2,o){if(u||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),u=1);o=e}else if((t=(d=p.n<0)?c:r.call(n,p))!==i)break}catch(t){o=e,u=1,c=t}finally{s=1}}return{value:t,done:d}}}(r,a,o),!0),s}var i={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][n]?t(t([][n]())):(l(t={},n,function(){return this}),t),d=s.prototype=u.prototype=Object.create(f);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,l(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=s,l(d,"constructor",s),l(s,"constructor",c),c.displayName="GeneratorFunction",l(s,a,"GeneratorFunction"),l(d),l(d,a,"Generator"),l(d,n,function(){return this}),l(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:v}})()}function l(e,t,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}l=function(e,t,r,n){function o(t,r){l(e,t,function(e){return this._invoke(t,r,e)})}t?a?a(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},l(e,t,r,n)}function v(e,t){this.v=e,this.k=t}function y(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function b(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){y(o,n,a,i,u,"next",e)}function u(e){y(o,n,a,i,u,"throw",e)}i(void 0)})}}window.TKHQ=n;var h=null,m=new AbortController,g=new AbortController,w=!1,E=function(){var e=b(i().mark(function e(t){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data||"INJECT_IMPORT_BUNDLE"!=t.data.type){e.next=9;break}return e.prev=1,e.next=4,k(t.data.value,t.data.organizationId,t.data.userId,t.data.requestId);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),n.sendMessageUp("ERROR",e.t0.toString(),t.data.requestId);case 9:if(!t.data||"EXTRACT_WALLET_ENCRYPTED_BUNDLE"!=t.data.type){e.next=18;break}return e.prev=10,e.next=13,T(t.data.requestId);case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(10),n.sendMessageUp("ERROR",e.t1.toString(),t.data.requestId);case 18:if(!t.data||"EXTRACT_KEY_ENCRYPTED_BUNDLE"!=t.data.type){e.next=27;break}return e.prev=19,e.next=22,P(t.data.keyFormat,t.data.requestId);case 22:e.next=27;break;case 24:e.prev=24,e.t2=e.catch(19),n.sendMessageUp("ERROR",e.t2.toString(),t.data.requestId);case 27:if(!t.data||"APPLY_SETTINGS"!=t.data.type){e.next=36;break}return e.prev=28,e.next=31,I(t.data.value,t.data.requestId);case 31:e.next=36;break;case 33:e.prev=33,e.t3=e.catch(28),n.sendMessageUp("ERROR",e.t3.toString(),t.data.requestId);case 36:case"end":return e.stop()}},e,null,[[1,6],[10,15],[19,24],[28,33]])}));return function(t){return e.apply(this,arguments)}}();function x(e){if(e.includes("\n--PASS--\n"))throw new Error('mnemonic cannot include the string "\\n--PASS--\\n"');if(e.includes("\n"))throw new Error("mnemonic cannot include newline characters")}function k(e,t,r,n){return S.apply(this,arguments)}function S(){return(S=b(i().mark(function e(t,r,a,o){var u,c,s,f;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:c=JSON.parse(t),e.t0=c.version,e.next="v1.0.0"===e.t0?4:34;break;case 4:if(c.data){e.next=6;break}throw new Error('missing "data" in bundle');case 6:if(c.dataSignature){e.next=8;break}throw new Error('missing "dataSignature" in bundle');case 8:if(c.enclaveQuorumPublic){e.next=10;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 10:if(n.verifyEnclaveSignature){e.next=12;break}throw new Error("method not loaded");case 12:return e.next=14,n.verifyEnclaveSignature(c.enclaveQuorumPublic,c.dataSignature,c.data);case 14:if(e.sent){e.next=17;break}throw new Error("failed to verify enclave signature: ".concat(t));case 17:if(s=JSON.parse((new TextDecoder).decode(n.uint8arrayFromHexString(c.data))),r){e.next=22;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.next=24;break;case 22:if(s.organizationId&&s.organizationId===r){e.next=24;break}throw new Error("organization id does not match expected value. Expected: ".concat(r,". Found: ").concat(s.organizationId,"."));case 24:if(a){e.next=28;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.'),e.next=30;break;case 28:if(s.userId&&s.userId===a){e.next=30;break}throw new Error("user id does not match expected value. Expected: ".concat(a,". Found: ").concat(s.userId,"."));case 30:if(s.targetPublic){e.next=32;break}throw new Error('missing "targetPublic" in bundle signed data');case 32:return u=n.uint8arrayFromHexString(s.targetPublic),e.abrupt("break",35);case 34:throw new Error("unsupported version: ".concat(c.version));case 35:return e.next=37,n.loadTargetKey(new Uint8Array(u));case 37:f=e.sent,n.setTargetEmbeddedKey(f),n.sendMessageUp("BUNDLE_INJECTED",!0,o);case 40:case"end":return e.stop()}},e)}))).apply(this,arguments)}function T(e){return O.apply(this,arguments)}function O(){return(O=b(i().mark(function e(t){var r,o,u,c,s,f;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=n.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(o=document.getElementById("plaintext").value.trim()){e.next=6;break}throw new Error("no wallet mnemonic entered");case 6:return u=document.getElementById("passphrase").value,x(o),c=""===u?o:"".concat(o,"\n--PASS--\n").concat(u),s=(new TextEncoder).encode(c),e.next=12,(0,a.q)({plaintextBuf:s,receiverPubJwk:r});case 12:f=e.sent,n.resetTargetEmbeddedKey(),n.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED",f,t);case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}function P(e,t){return _.apply(this,arguments)}function _(){return(_=b(i().mark(function e(t,r){var o,u,c,s;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(o=n.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(u=document.getElementById("plaintext").value.trim()){e.next=6;break}throw new Error("no private key entered");case 6:return e.next=8,n.decodeKey(u,t);case 8:return c=e.sent,e.next=11,(0,a.q)({plaintextBuf:c,receiverPubJwk:o});case 11:s=e.sent,n.resetTargetEmbeddedKey(),n.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED",s,r);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function I(e,t){return N.apply(this,arguments)}function N(){return(N=b(i().mark(function e(t,r){var a;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=n.applySettings(t),n.setSettings(a),n.sendMessageUp("SETTINGS_APPLIED",!0,r);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}document.addEventListener("DOMContentLoaded",b(i().mark(function e(){var t,r;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(window.addEventListener("message",E,{capture:!1,signal:m.signal}),m.signal.aborted){e.next=9;break}if((t=n.getSettings())&&n.applySettings(t),n.sendMessageUp("PUBLIC_KEY_READY",""),r=document.getElementById("plaintext")){e.next=8;break}return e.abrupt("return");case 8:r.addEventListener("paste",b(i().mark(function e(){var t;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query({name:"clipboard-write"}).catch(function(){return null});case 3:if("granted"!==(null==(t=e.sent)?void 0:t.state)&&"prompt"!==(null==t?void 0:t.state)){e.next=7;break}return e.next=7,navigator.clipboard.writeText("");case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}},e,null,[[0,9]])})));case 9:case"end":return e.stop()}},e)})),!1),window.addEventListener("message",function(){var e=b(i().mark(function e(t){var r;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data||"TURNKEY_INIT_MESSAGE_CHANNEL"!=t.data.type||null===(r=t.ports)||void 0===r||!r[0]){e.next=10;break}if(!w){e.next=3;break}return e.abrupt("return");case 3:w=!0,m.abort(),(h=t.ports[0]).onmessage=E,n.setParentFrameMessageChannelPort(h),n.sendMessageUp("PUBLIC_KEY_READY",""),g.abort();case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),{signal:g.signal})}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,u),r.exports}u.m=o,e=[],u.O=(t,r,n,a)=>{if(!r){var o=1/0;for(f=0;f=a)&&Object.keys(u.O).every(e=>u.O[e](r[c]))?r.splice(c--,1):(i=!1,a0&&e[f-1][2]>a;f--)e[f]=e[f-1];e[f]=[r,n,a]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var a=Object.create(null);u.r(a);var o={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>o[t]=()=>e[t]);return o.default=()=>e,u.d(a,o),a},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>e+".bundle."+{291:"b62abe64ba4ebf68e89b",825:"3a4aff0e743a7540fe25"}[e]+".js",u.miniCssF=e=>{},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},a="import:",u.l=(e,t,r,o)=>{if(n[e])n[e].push(t);else{var i,c;if(void 0!==r)for(var s=document.getElementsByTagName("script"),f=0;f{i.onerror=i.onload=null,clearTimeout(l);var a=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(r)),t)return t(r)},l=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),c&&document.head.appendChild(i)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="/",(()=>{var e={57:0};u.f.j=(t,r)=>{var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,a)=>n=e[t]=[r,a]);r.push(n[2]=a);var o=u.p+u.u(t),i=new Error;u.l(o,r=>{if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[o,i,c]=r,s=0;if(o.some(t=>0!==e[t])){for(n in i)u.o(i,n)&&(u.m[n]=i[n]);if(c)var f=c(u)}for(t&&t(r);su(954));c=u.O(c)})();
+//# sourceMappingURL=index.bundle.5f5e5ca1b811d13b75e8.js.map
\ No newline at end of file
diff --git a/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js.LICENSE.txt b/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js.LICENSE.txt
similarity index 100%
rename from import/dist/index.bundle.fd323f4d5a9bfc580fd2.js.LICENSE.txt
rename to import/dist/index.bundle.5f5e5ca1b811d13b75e8.js.LICENSE.txt
diff --git a/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js.map b/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js.map
new file mode 100644
index 0000000..6168da4
--- /dev/null
+++ b/import/dist/index.bundle.5f5e5ca1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,KAAMyO,EAAmBxC,KAAKjM,KAAKyO,G,KClFvF,IAAIE,EAAsBrF,EAAoBO,OAAEJ,EAAW,CAAC,GAAG,KAAM,IAAOH,EAAoB,MAChGqF,EAAsBrF,EAAoBO,EAAE8E,E","sources":["webpack://import/webpack/runtime/chunk loaded","webpack://import/webpack/runtime/create fake namespace object","webpack://import/webpack/runtime/load script","webpack://import/./src/index.js","webpack://import/webpack/bootstrap","webpack://import/webpack/runtime/define property getters","webpack://import/webpack/runtime/ensure chunk","webpack://import/webpack/runtime/get javascript chunk filename","webpack://import/webpack/runtime/get mini-css chunk filename","webpack://import/webpack/runtime/global","webpack://import/webpack/runtime/hasOwnProperty shorthand","webpack://import/webpack/runtime/make namespace object","webpack://import/webpack/runtime/publicPath","webpack://import/webpack/runtime/jsonp chunk loading","webpack://import/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"import:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import \"./styles.css\";\nimport * as TKHQ from \"./turnkey-core.js\";\nimport { HpkeEncrypt } from \"@shared/crypto-utils.js\";\n\n// Make TKHQ available globally for backwards compatibility\nwindow.TKHQ = TKHQ;\n\n// persist the MessageChannel object so we can use it to communicate with the parent window\nvar iframeMessagePort = null;\n\n// controllers to remove event listeners\nconst messageListenerController = new AbortController();\nconst turnkeyInitController = new AbortController();\n\n// Guard to prevent concurrent channel establishment from multiple senders\nlet channelEstablished = false;\n\n/**\n * Message Event Handlers to process messages from the parent frame\n */\nvar messageEventListener = async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_IMPORT_BUNDLE\") {\n try {\n await onInjectImportBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"userId\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\") {\n try {\n await onExtractWalletEncryptedBundle(event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"EXTRACT_KEY_ENCRYPTED_BUNDLE\") {\n try {\n await onExtractKeyEncryptedBundle(\n event.data[\"keyFormat\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"APPLY_SETTINGS\") {\n try {\n await onApplySettings(event.data[\"value\"], event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n};\n\n/**\n * Broadcast that the frame is ready and set up the message event listeners\n */\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async function () {\n window.addEventListener(\"message\", messageEventListener, {\n capture: false,\n signal: messageListenerController.signal,\n });\n\n if (!messageListenerController.signal.aborted) {\n // If styles are saved in local storage, sanitize and apply them.\n const styleSettings = TKHQ.getSettings();\n if (styleSettings) {\n TKHQ.applySettings(styleSettings);\n }\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", \"\");\n\n const plaintextTextarea = document.getElementById(\"plaintext\");\n if (!plaintextTextarea) return;\n // Clear clipboard after paste to avoid sensitive data lingering in clipboard.\n\n plaintextTextarea.addEventListener(\"paste\", async () => {\n // Let the paste happen first\n try {\n // Check clipboard-write permission first. In new versions of iframe-stamper, we add this permission when creating the iframe. In older versions, this permission is not added.\n const permStatus = await navigator.permissions\n .query({ name: \"clipboard-write\" }) // This is required to avoid error on clipboard write\n .catch(() => null);\n\n // Proceed only if granted or promptable\n if (\n permStatus?.state === \"granted\" ||\n permStatus?.state === \"prompt\"\n ) {\n await navigator.clipboard.writeText(\"\");\n }\n } catch {\n // Silently ignore any errors — no warnings or console noise\n }\n });\n }\n },\n false\n);\n\nwindow.addEventListener(\n \"message\",\n async function (event) {\n /**\n * @turnkey/iframe-stamper >= v2.1.0 is using a MessageChannel to communicate with the parent frame.\n * The parent frame sends a TURNKEY_INIT_MESSAGE_CHANNEL event with the MessagePort.\n * If we receive this event, we want to remove the message event listener that was added in the DOMContentLoaded event to avoid processing messages twice.\n * We persist the MessagePort so we can use it to communicate with the parent window in subsequent calls to TKHQ.sendMessageUp\n */\n if (\n event.data &&\n event.data[\"type\"] == \"TURNKEY_INIT_MESSAGE_CHANNEL\" &&\n event.ports?.[0]\n ) {\n // Synchronously check-and-set the flag before any await. This prevents\n // a second concurrent invocation from racing through while the first is\n // suspended at an await, which would allow multiple origins to establish\n // a channel before turnkeyInitController.abort() is reached.\n if (channelEstablished) {\n return;\n }\n channelEstablished = true;\n\n // remove the message event listener that was added in the DOMContentLoaded event\n messageListenerController.abort();\n\n iframeMessagePort = event.ports[0];\n iframeMessagePort.onmessage = messageEventListener;\n\n TKHQ.setParentFrameMessageChannelPort(iframeMessagePort);\n\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", \"\");\n\n // remove the listener for TURNKEY_INIT_MESSAGE_CHANNEL after it's been processed\n turnkeyInitController.abort();\n }\n },\n { signal: turnkeyInitController.signal }\n);\n\n// make sure the mnemonic does not include our splitter (\\n--PASS--\\n) string or \\n characters\nfunction validateMnemonic(mnemonic) {\n if (mnemonic.includes(\"\\n--PASS--\\n\")) {\n throw new Error('mnemonic cannot include the string \"\\\\n--PASS--\\\\n\"');\n }\n if (mnemonic.includes(\"\\n\")) {\n throw new Error(\"mnemonic cannot include newline characters\");\n }\n}\n\n/**\n * Function triggered when INJECT_IMPORT_BUNDLE event is received.\n * Parses the `import_bundle` and stores the target public key as a JWK\n * in local storage. Sends true upon success.\n * @param {string} bundle\n * Example bundle: {\"targetPublic\":\"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f\",\"targetPublicSignature\":\"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f\",\"enclaveQuorumPublic\":\"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\"}\n * @param {string} organizationId\n * @param {string} userId\n * @param {string} requestId\n */\nasync function onInjectImportBundle(bundle, organizationId, userId, requestId) {\n let targetPublicBuf;\n let verified;\n\n // Parse the import bundle\n const bundleObj = JSON.parse(bundle);\n\n switch (bundleObj.version) {\n case \"v1.0.0\": {\n // Validate fields exist\n if (!bundleObj.data) {\n throw new Error('missing \"data\" in bundle');\n }\n if (!bundleObj.dataSignature) {\n throw new Error('missing \"dataSignature\" in bundle');\n }\n if (!bundleObj.enclaveQuorumPublic) {\n throw new Error('missing \"enclaveQuorumPublic\" in bundle');\n }\n\n // Verify enclave signature\n if (!TKHQ.verifyEnclaveSignature) {\n throw new Error(\"method not loaded\");\n }\n verified = await TKHQ.verifyEnclaveSignature(\n bundleObj.enclaveQuorumPublic,\n bundleObj.dataSignature,\n bundleObj.data\n );\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${bundle}`);\n }\n\n // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here.\n const signedData = JSON.parse(\n new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data))\n );\n\n // Validate fields match\n if (!organizationId) {\n // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"organizationId\" for security purposes.'\n );\n } else if (\n !signedData.organizationId ||\n signedData.organizationId !== organizationId\n ) {\n throw new Error(\n `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`\n );\n }\n if (!userId) {\n // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"userId\" for security purposes.'\n );\n } else if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(\n `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`\n );\n }\n\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n\n // Load target public key generated from enclave and set in local storage\n targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic);\n break;\n }\n default:\n throw new Error(`unsupported version: ${bundleObj.version}`);\n }\n\n const targetPublicKeyJwk = await TKHQ.loadTargetKey(\n new Uint8Array(targetPublicBuf)\n );\n TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk);\n\n // Send up BUNDLE_INJECTED message\n TKHQ.sendMessageUp(\"BUNDLE_INJECTED\", true, requestId);\n}\n\n/**\n * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the text entered in the\n * `plaintext` textarea element. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n * @param {string} requestId\n */\nasync function onExtractWalletEncryptedBundle(requestId) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext wallet mnemonic\n const plaintext = document.getElementById(\"plaintext\").value.trim();\n if (!plaintext) {\n throw new Error(\"no wallet mnemonic entered\");\n }\n\n const passphrase = document.getElementById(\"passphrase\").value;\n\n validateMnemonic(plaintext);\n\n const combined =\n passphrase === \"\" ? plaintext : `${plaintext}\\n--PASS--\\n${passphrase}`;\n const plaintextBuf = new TextEncoder().encode(combined);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n TKHQ.sendMessageUp(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle, requestId);\n}\n\n/**\n * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the text entered in the\n * `plaintext` textarea element. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n * @param {string} keyFormat\n * @param {string} requestId\n */\nasync function onExtractKeyEncryptedBundle(keyFormat, requestId) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext private key\n const plaintext = document.getElementById(\"plaintext\").value.trim();\n if (!plaintext) {\n throw new Error(\"no private key entered\");\n }\n const plaintextBuf = await TKHQ.decodeKey(plaintext, keyFormat);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n TKHQ.sendMessageUp(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle, requestId);\n}\n\n/**\n * Function triggered when APPLY_SETTINGS event is received.\n * For now, the only settings that can be applied are for \"styles\".\n * Persist them in local storage so they can be applied on every\n * page load.\n * @param {string} settings: JSON-stringified settings\n * @param {string} requestId\n */\nasync function onApplySettings(settings, requestId) {\n // Apply settings\n const validSettings = TKHQ.applySettings(settings);\n\n // Persist in local storage\n TKHQ.setSettings(validSettings);\n\n // Send up SETTINGS_APPLIED message\n TKHQ.sendMessageUp(\"SETTINGS_APPLIED\", true, requestId);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".bundle.\" + {\"291\":\"b62abe64ba4ebf68e89b\",\"825\":\"3a4aff0e743a7540fe25\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t57: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkimport\"] = self[\"webpackChunkimport\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96,551], () => (__webpack_require__(954)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","_OverloadYield","k","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","window","TKHQ","iframeMessagePort","messageListenerController","AbortController","turnkeyInitController","channelEstablished","messageEventListener","_ref","_regeneratorRuntime","mark","_callee","event","wrap","_context","prev","next","data","onInjectImportBundle","t0","toString","onExtractWalletEncryptedBundle","t1","onExtractKeyEncryptedBundle","t2","onApplySettings","t3","stop","_x","validateMnemonic","mnemonic","includes","Error","_x3","_x4","_x5","_x6","_onInjectImportBundle","_callee5","bundle","organizationId","userId","requestId","targetPublicBuf","bundleObj","signedData","targetPublicKeyJwk","_context5","JSON","parse","version","dataSignature","enclaveQuorumPublic","sent","concat","TextDecoder","decode","console","warn","targetPublic","abrupt","Uint8Array","_x7","_onExtractWalletEncryptedBundle","_callee6","plaintext","passphrase","combined","plaintextBuf","encryptedBundle","_context6","document","getElementById","trim","TextEncoder","encode","HpkeEncrypt","receiverPubJwk","_x8","_x9","_onExtractKeyEncryptedBundle","_callee7","keyFormat","_context7","_x10","_x11","_onApplySettings","_callee8","settings","validSettings","_context8","addEventListener","_callee3","styleSettings","plaintextTextarea","_context3","capture","signal","aborted","_callee2","permStatus","_context2","navigator","permissions","query","name","state","clipboard","writeText","_ref4","_callee4","_event$ports","_context4","ports","abort","onmessage","_x2","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","key","splice","obj","mode","this","__esModule","ns","def","current","indexOf","getOwnPropertyNames","forEach","definition","get","chunkId","all","reduce","promises","miniCssF","g","globalThis","Function","prop","hasOwnProperty","url","push","script","needAttach","scripts","getElementsByTagName","s","getAttribute","createElement","charset","nc","setAttribute","src","onScriptComplete","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","type","target","head","appendChild","installedChunks","installedChunkData","promise","reject","error","errorType","realSrc","message","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""}
\ No newline at end of file
diff --git a/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js b/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js
deleted file mode 100644
index 33fb477..0000000
--- a/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! For license information please see index.bundle.fd323f4d5a9bfc580fd2.js.LICENSE.txt */
-(()=>{"use strict";var e,t,r,n,a,o={954:(e,t,r)=>{var n=r(482),a=r(584);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(){var e=l(),t=e.m(i),r=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function n(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===r||"GeneratorFunction"===(t.displayName||t.name))}var a={throw:1,return:2,break:3,continue:3};function o(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,a[e],t)},delegateYield:function(e,a,o){return t.resultName=a,r(n.d,u(e),o)},finish:function(e){return r(n.f,e)}},r=function(e,r,a){n.p=t.prev,n.n=t.next;try{return e(r,a)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(i=function(){return{wrap:function(t,r,n,a){return e.w(o(t),r,n,a&&a.reverse())},isGeneratorFunction:n,mark:e.m,awrap:function(e,t){return new v(e,t)},AsyncIterator:d,async:function(e,t,r,a,i){return(n(t)?f:s)(o(e),t,r,a,i)},keys:c,values:u}})()}function u(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(o(e)+" is not iterable")}function c(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function s(e,t,r,n,a){var o=f(e,t,r,n,a);return o.next().then(function(e){return e.done?e.value:o.next()})}function f(e,t,r,n,a){return new d(l().w(e,t,r,n),a||Promise)}function d(e,t){function r(n,a,o,i){try{var u=e[n](a),c=u.value;return c instanceof v?t.resolve(c.v).then(function(e){r("next",e,o,i)},function(e){r("throw",e,o,i)}):t.resolve(c).then(function(e){u.value=e,o(u)},function(e){return r("throw",e,o,i)})}catch(e){i(e)}}var n;this.next||(p(d.prototype),p(d.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),p(this,"_invoke",function(e,a,o){function i(){return new t(function(t,n){r(e,o,t,n)})}return n=n?n.then(i,i):i()},!0)}function l(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return p(s,"_invoke",function(r,n,a){var o,u,c,s=0,f=a||[],d=!1,l={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,u=0,c=e,l.n=r,i}};function p(r,n){for(u=r,c=n,t=0;!d&&s&&!a&&t3?(a=v===n)&&(c=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=p&&((a=r<2&&pn||n>v)&&(o[4]=r,o[5]=n,l.n=v,u=0))}if(a||r>1)return i;throw d=!0,n}return function(a,f,v){if(s>1)throw TypeError("Generator is already running");for(d&&1===f&&p(f,v),u=f,c=v;(t=u<2?e:c)||!d;){o||(u?u<3?(u>1&&(l.n=-1),p(u,c)):l.n=c:l.v=c);try{if(s=2,o){if(u||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),u=1);o=e}else if((t=(d=l.n<0)?c:r.call(n,l))!==i)break}catch(t){o=e,u=1,c=t}finally{s=1}}return{value:t,done:d}}}(r,a,o),!0),s}var i={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][n]?t(t([][n]())):(p(t={},n,function(){return this}),t),d=s.prototype=u.prototype=Object.create(f);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,p(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=s,p(d,"constructor",s),p(s,"constructor",c),c.displayName="GeneratorFunction",p(s,a,"GeneratorFunction"),p(d),p(d,a,"Generator"),p(d,n,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:v}})()}function p(e,t,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}p=function(e,t,r,n){function o(t,r){p(e,t,function(e){return this._invoke(t,r,e)})}t?a?a(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},p(e,t,r,n)}function v(e,t){this.v=e,this.k=t}function y(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function b(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){y(o,n,a,i,u,"next",e)}function u(e){y(o,n,a,i,u,"throw",e)}i(void 0)})}}window.TKHQ=n;var h=null,m=new AbortController,g=new AbortController,w=function(){var e=b(i().mark(function e(t){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data||"INJECT_IMPORT_BUNDLE"!=t.data.type){e.next=9;break}return e.prev=1,e.next=4,x(t.data.value,t.data.organizationId,t.data.userId,t.data.requestId);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),n.sendMessageUp("ERROR",e.t0.toString(),t.data.requestId);case 9:if(!t.data||"EXTRACT_WALLET_ENCRYPTED_BUNDLE"!=t.data.type){e.next=18;break}return e.prev=10,e.next=13,S(t.data.requestId);case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(10),n.sendMessageUp("ERROR",e.t1.toString(),t.data.requestId);case 18:if(!t.data||"EXTRACT_KEY_ENCRYPTED_BUNDLE"!=t.data.type){e.next=27;break}return e.prev=19,e.next=22,O(t.data.keyFormat,t.data.requestId);case 22:e.next=27;break;case 24:e.prev=24,e.t2=e.catch(19),n.sendMessageUp("ERROR",e.t2.toString(),t.data.requestId);case 27:if(!t.data||"APPLY_SETTINGS"!=t.data.type){e.next=36;break}return e.prev=28,e.next=31,_(t.data.value,t.data.requestId);case 31:e.next=36;break;case 33:e.prev=33,e.t3=e.catch(28),n.sendMessageUp("ERROR",e.t3.toString(),t.data.requestId);case 36:case"end":return e.stop()}},e,null,[[1,6],[10,15],[19,24],[28,33]])}));return function(t){return e.apply(this,arguments)}}();function E(e){if(e.includes("\n--PASS--\n"))throw new Error('mnemonic cannot include the string "\\n--PASS--\\n"');if(e.includes("\n"))throw new Error("mnemonic cannot include newline characters")}function x(e,t,r,n){return k.apply(this,arguments)}function k(){return(k=b(i().mark(function e(t,r,a,o){var u,c,s,f;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:c=JSON.parse(t),e.t0=c.version,e.next="v1.0.0"===e.t0?4:34;break;case 4:if(c.data){e.next=6;break}throw new Error('missing "data" in bundle');case 6:if(c.dataSignature){e.next=8;break}throw new Error('missing "dataSignature" in bundle');case 8:if(c.enclaveQuorumPublic){e.next=10;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 10:if(n.verifyEnclaveSignature){e.next=12;break}throw new Error("method not loaded");case 12:return e.next=14,n.verifyEnclaveSignature(c.enclaveQuorumPublic,c.dataSignature,c.data);case 14:if(e.sent){e.next=17;break}throw new Error("failed to verify enclave signature: ".concat(t));case 17:if(s=JSON.parse((new TextDecoder).decode(n.uint8arrayFromHexString(c.data))),r){e.next=22;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.next=24;break;case 22:if(s.organizationId&&s.organizationId===r){e.next=24;break}throw new Error("organization id does not match expected value. Expected: ".concat(r,". Found: ").concat(s.organizationId,"."));case 24:if(a){e.next=28;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.'),e.next=30;break;case 28:if(s.userId&&s.userId===a){e.next=30;break}throw new Error("user id does not match expected value. Expected: ".concat(a,". Found: ").concat(s.userId,"."));case 30:if(s.targetPublic){e.next=32;break}throw new Error('missing "targetPublic" in bundle signed data');case 32:return u=n.uint8arrayFromHexString(s.targetPublic),e.abrupt("break",35);case 34:throw new Error("unsupported version: ".concat(c.version));case 35:return e.next=37,n.loadTargetKey(new Uint8Array(u));case 37:f=e.sent,n.setTargetEmbeddedKey(f),n.sendMessageUp("BUNDLE_INJECTED",!0,o);case 40:case"end":return e.stop()}},e)}))).apply(this,arguments)}function S(e){return T.apply(this,arguments)}function T(){return(T=b(i().mark(function e(t){var r,o,u,c,s,f;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=n.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(o=document.getElementById("plaintext").value.trim()){e.next=6;break}throw new Error("no wallet mnemonic entered");case 6:return u=document.getElementById("passphrase").value,E(o),c=""===u?o:"".concat(o,"\n--PASS--\n").concat(u),s=(new TextEncoder).encode(c),e.next=12,(0,a.q)({plaintextBuf:s,receiverPubJwk:r});case 12:f=e.sent,n.resetTargetEmbeddedKey(),n.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED",f,t);case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}function O(e,t){return P.apply(this,arguments)}function P(){return(P=b(i().mark(function e(t,r){var o,u,c,s;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(o=n.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(u=document.getElementById("plaintext").value.trim()){e.next=6;break}throw new Error("no private key entered");case 6:return e.next=8,n.decodeKey(u,t);case 8:return c=e.sent,e.next=11,(0,a.q)({plaintextBuf:c,receiverPubJwk:o});case 11:s=e.sent,n.resetTargetEmbeddedKey(),n.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED",s,r);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _(e,t){return I.apply(this,arguments)}function I(){return(I=b(i().mark(function e(t,r){var a;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=n.applySettings(t),n.setSettings(a),n.sendMessageUp("SETTINGS_APPLIED",!0,r);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}document.addEventListener("DOMContentLoaded",b(i().mark(function e(){var t,r;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(window.addEventListener("message",w,{capture:!1,signal:m.signal}),m.signal.aborted){e.next=9;break}if((t=n.getSettings())&&n.applySettings(t),n.sendMessageUp("PUBLIC_KEY_READY",""),r=document.getElementById("plaintext")){e.next=8;break}return e.abrupt("return");case 8:r.addEventListener("paste",b(i().mark(function e(){var t;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query({name:"clipboard-write"}).catch(function(){return null});case 3:if("granted"!==(null==(t=e.sent)?void 0:t.state)&&"prompt"!==(null==t?void 0:t.state)){e.next=7;break}return e.next=7,navigator.clipboard.writeText("");case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}},e,null,[[0,9]])})));case 9:case"end":return e.stop()}},e)})),!1),window.addEventListener("message",function(){var e=b(i().mark(function e(t){var r;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.data&&"TURNKEY_INIT_MESSAGE_CHANNEL"==t.data.type&&null!==(r=t.ports)&&void 0!==r&&r[0]&&(m.abort(),(h=t.ports[0]).onmessage=w,n.setParentFrameMessageChannelPort(h),n.sendMessageUp("PUBLIC_KEY_READY",""),g.abort());case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),{signal:g.signal})}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,u),r.exports}u.m=o,e=[],u.O=(t,r,n,a)=>{if(!r){var o=1/0;for(f=0;f=a)&&Object.keys(u.O).every(e=>u.O[e](r[c]))?r.splice(c--,1):(i=!1,a0&&e[f-1][2]>a;f--)e[f]=e[f-1];e[f]=[r,n,a]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var a=Object.create(null);u.r(a);var o={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>o[t]=()=>e[t]);return o.default=()=>e,u.d(a,o),a},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>e+".bundle."+{291:"b62abe64ba4ebf68e89b",825:"3a4aff0e743a7540fe25"}[e]+".js",u.miniCssF=e=>{},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},a="import:",u.l=(e,t,r,o)=>{if(n[e])n[e].push(t);else{var i,c;if(void 0!==r)for(var s=document.getElementsByTagName("script"),f=0;f{i.onerror=i.onload=null,clearTimeout(p);var a=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(r)),t)return t(r)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),c&&document.head.appendChild(i)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="/",(()=>{var e={57:0};u.f.j=(t,r)=>{var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,a)=>n=e[t]=[r,a]);r.push(n[2]=a);var o=u.p+u.u(t),i=new Error;u.l(o,r=>{if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[o,i,c]=r,s=0;if(o.some(t=>0!==e[t])){for(n in i)u.o(i,n)&&(u.m[n]=i[n]);if(c)var f=c(u)}for(t&&t(r);su(954));c=u.O(c)})();
-//# sourceMappingURL=index.bundle.fd323f4d5a9bfc580fd2.js.map
\ No newline at end of file
diff --git a/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js.map b/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js.map
deleted file mode 100644
index 580c53e..0000000
--- a/import/dist/index.bundle.fd323f4d5a9bfc580fd2.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"index.bundle.fd323f4d5a9bfc580fd2.js","mappings":";uBAAIA,ECCAC,EADAC,ECAAC,EACAC,E,24ECAJ,IAAAC,EAAAC,EAAAC,EAAA,mBAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,aAAA,yBAAAC,EAAAN,EAAAE,EAAAE,EAAAE,GAAA,IAAAC,EAAAL,GAAAA,EAAAM,qBAAAC,EAAAP,EAAAO,EAAAC,EAAAC,OAAAC,OAAAL,EAAAC,WAAA,OAAAK,EAAAH,EAAA,mBAAAV,EAAAE,EAAAE,GAAA,IAAAE,EAAAC,EAAAG,EAAAI,EAAA,EAAAC,EAAAX,GAAA,GA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G,EAAU+B,GAHTvB,EAAUsE,EAAaC,GAAWrL,EAGhB/D,EAAI,EAC3B,GAAG6K,EAASwE,KAAMC,GAAgC,IAAxBd,EAAgBc,IAAa,CACtD,IAAIjF,KAAY8E,EACZ/E,EAAoBtK,EAAEqP,EAAa9E,KACrCD,EAAoBtI,EAAEuI,GAAY8E,EAAY9E,IAGhD,GAAG+E,EAAS,IAAIxE,EAASwE,EAAQhF,EAClC,CAEA,IADG8E,GAA4BA,EAA2BnL,GACrD/D,EAAI6K,EAAS7J,OAAQhB,IACzBoM,EAAUvB,EAAS7K,GAChBoK,EAAoBtK,EAAE0O,EAAiBpC,IAAYoC,EAAgBpC,IACrEoC,EAAgBpC,GAAS,KAE1BoC,EAAgBpC,GAAW,EAE5B,OAAOhC,EAAoBO,EAAEC,IAG1B2E,EAAqBC,KAAyB,mBAAIA,KAAyB,oBAAK,GACpFD,EAAmBtD,QAAQgD,EAAqBlO,KAAK,KAAM,IAC3DwO,EAAmBxC,KAAOkC,EAAqBlO,KAAK,KAAMwO,EAAmBxC,KAAKhM,KAAKwO,G,KClFvF,IAAIE,EAAsBrF,EAAoBO,OAAEJ,EAAW,CAAC,GAAG,KAAM,IAAOH,EAAoB,MAChGqF,EAAsBrF,EAAoBO,EAAE8E,E","sources":["webpack://import/webpack/runtime/chunk loaded","webpack://import/webpack/runtime/create fake namespace object","webpack://import/webpack/runtime/load script","webpack://import/./src/index.js","webpack://import/webpack/bootstrap","webpack://import/webpack/runtime/define property getters","webpack://import/webpack/runtime/ensure chunk","webpack://import/webpack/runtime/get javascript chunk filename","webpack://import/webpack/runtime/get mini-css chunk filename","webpack://import/webpack/runtime/global","webpack://import/webpack/runtime/hasOwnProperty shorthand","webpack://import/webpack/runtime/make namespace object","webpack://import/webpack/runtime/publicPath","webpack://import/webpack/runtime/jsonp chunk loading","webpack://import/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"import:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import \"./styles.css\";\nimport * as TKHQ from \"./turnkey-core.js\";\nimport { HpkeEncrypt } from \"@shared/crypto-utils.js\";\n\n// Make TKHQ available globally for backwards compatibility\nwindow.TKHQ = TKHQ;\n\n// persist the MessageChannel object so we can use it to communicate with the parent window\nvar iframeMessagePort = null;\n\n// controllers to remove event listeners\nconst messageListenerController = new AbortController();\nconst turnkeyInitController = new AbortController();\n\n/**\n * Message Event Handlers to process messages from the parent frame\n */\nvar messageEventListener = async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_IMPORT_BUNDLE\") {\n try {\n await onInjectImportBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"userId\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\") {\n try {\n await onExtractWalletEncryptedBundle(event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"EXTRACT_KEY_ENCRYPTED_BUNDLE\") {\n try {\n await onExtractKeyEncryptedBundle(\n event.data[\"keyFormat\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"APPLY_SETTINGS\") {\n try {\n await onApplySettings(event.data[\"value\"], event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n};\n\n/**\n * Broadcast that the frame is ready and set up the message event listeners\n */\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async function () {\n window.addEventListener(\"message\", messageEventListener, {\n capture: false,\n signal: messageListenerController.signal,\n });\n\n if (!messageListenerController.signal.aborted) {\n // If styles are saved in local storage, sanitize and apply them.\n const styleSettings = TKHQ.getSettings();\n if (styleSettings) {\n TKHQ.applySettings(styleSettings);\n }\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", \"\");\n\n const plaintextTextarea = document.getElementById(\"plaintext\");\n if (!plaintextTextarea) return;\n // Clear clipboard after paste to avoid sensitive data lingering in clipboard.\n\n plaintextTextarea.addEventListener(\"paste\", async () => {\n // Let the paste happen first\n try {\n // Check clipboard-write permission first. In new versions of iframe-stamper, we add this permission when creating the iframe. In older versions, this permission is not added.\n const permStatus = await navigator.permissions\n .query({ name: \"clipboard-write\" }) // This is required to avoid error on clipboard write\n .catch(() => null);\n\n // Proceed only if granted or promptable\n if (\n permStatus?.state === \"granted\" ||\n permStatus?.state === \"prompt\"\n ) {\n await navigator.clipboard.writeText(\"\");\n }\n } catch {\n // Silently ignore any errors — no warnings or console noise\n }\n });\n }\n },\n false\n);\n\nwindow.addEventListener(\n \"message\",\n async function (event) {\n /**\n * @turnkey/iframe-stamper >= v2.1.0 is using a MessageChannel to communicate with the parent frame.\n * The parent frame sends a TURNKEY_INIT_MESSAGE_CHANNEL event with the MessagePort.\n * If we receive this event, we want to remove the message event listener that was added in the DOMContentLoaded event to avoid processing messages twice.\n * We persist the MessagePort so we can use it to communicate with the parent window in subsequent calls to TKHQ.sendMessageUp\n */\n if (\n event.data &&\n event.data[\"type\"] == \"TURNKEY_INIT_MESSAGE_CHANNEL\" &&\n event.ports?.[0]\n ) {\n // remove the message event listener that was added in the DOMContentLoaded event\n messageListenerController.abort();\n\n iframeMessagePort = event.ports[0];\n iframeMessagePort.onmessage = messageEventListener;\n\n TKHQ.setParentFrameMessageChannelPort(iframeMessagePort);\n\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", \"\");\n\n // remove the listener for TURNKEY_INIT_MESSAGE_CHANNEL after it's been processed\n turnkeyInitController.abort();\n }\n },\n { signal: turnkeyInitController.signal }\n);\n\n// make sure the mnemonic does not include our splitter (\\n--PASS--\\n) string or \\n characters\nfunction validateMnemonic(mnemonic) {\n if (mnemonic.includes(\"\\n--PASS--\\n\")) {\n throw new Error('mnemonic cannot include the string \"\\\\n--PASS--\\\\n\"');\n }\n if (mnemonic.includes(\"\\n\")) {\n throw new Error(\"mnemonic cannot include newline characters\");\n }\n}\n\n/**\n * Function triggered when INJECT_IMPORT_BUNDLE event is received.\n * Parses the `import_bundle` and stores the target public key as a JWK\n * in local storage. Sends true upon success.\n * @param {string} bundle\n * Example bundle: {\"targetPublic\":\"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f\",\"targetPublicSignature\":\"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f\",\"enclaveQuorumPublic\":\"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\"}\n * @param {string} organizationId\n * @param {string} userId\n * @param {string} requestId\n */\nasync function onInjectImportBundle(bundle, organizationId, userId, requestId) {\n let targetPublicBuf;\n let verified;\n\n // Parse the import bundle\n const bundleObj = JSON.parse(bundle);\n\n switch (bundleObj.version) {\n case \"v1.0.0\": {\n // Validate fields exist\n if (!bundleObj.data) {\n throw new Error('missing \"data\" in bundle');\n }\n if (!bundleObj.dataSignature) {\n throw new Error('missing \"dataSignature\" in bundle');\n }\n if (!bundleObj.enclaveQuorumPublic) {\n throw new Error('missing \"enclaveQuorumPublic\" in bundle');\n }\n\n // Verify enclave signature\n if (!TKHQ.verifyEnclaveSignature) {\n throw new Error(\"method not loaded\");\n }\n verified = await TKHQ.verifyEnclaveSignature(\n bundleObj.enclaveQuorumPublic,\n bundleObj.dataSignature,\n bundleObj.data\n );\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${bundle}`);\n }\n\n // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here.\n const signedData = JSON.parse(\n new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data))\n );\n\n // Validate fields match\n if (!organizationId) {\n // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"organizationId\" for security purposes.'\n );\n } else if (\n !signedData.organizationId ||\n signedData.organizationId !== organizationId\n ) {\n throw new Error(\n `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`\n );\n }\n if (!userId) {\n // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"userId\" for security purposes.'\n );\n } else if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(\n `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`\n );\n }\n\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n\n // Load target public key generated from enclave and set in local storage\n targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic);\n break;\n }\n default:\n throw new Error(`unsupported version: ${bundleObj.version}`);\n }\n\n const targetPublicKeyJwk = await TKHQ.loadTargetKey(\n new Uint8Array(targetPublicBuf)\n );\n TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk);\n\n // Send up BUNDLE_INJECTED message\n TKHQ.sendMessageUp(\"BUNDLE_INJECTED\", true, requestId);\n}\n\n/**\n * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the text entered in the\n * `plaintext` textarea element. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n * @param {string} requestId\n */\nasync function onExtractWalletEncryptedBundle(requestId) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext wallet mnemonic\n const plaintext = document.getElementById(\"plaintext\").value.trim();\n if (!plaintext) {\n throw new Error(\"no wallet mnemonic entered\");\n }\n\n const passphrase = document.getElementById(\"passphrase\").value;\n\n validateMnemonic(plaintext);\n\n const combined =\n passphrase === \"\" ? plaintext : `${plaintext}\\n--PASS--\\n${passphrase}`;\n const plaintextBuf = new TextEncoder().encode(combined);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n TKHQ.sendMessageUp(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle, requestId);\n}\n\n/**\n * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the text entered in the\n * `plaintext` textarea element. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n * @param {string} keyFormat\n * @param {string} requestId\n */\nasync function onExtractKeyEncryptedBundle(keyFormat, requestId) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext private key\n const plaintext = document.getElementById(\"plaintext\").value.trim();\n if (!plaintext) {\n throw new Error(\"no private key entered\");\n }\n const plaintextBuf = await TKHQ.decodeKey(plaintext, keyFormat);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n TKHQ.sendMessageUp(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle, requestId);\n}\n\n/**\n * Function triggered when APPLY_SETTINGS event is received.\n * For now, the only settings that can be applied are for \"styles\".\n * Persist them in local storage so they can be applied on every\n * page load.\n * @param {string} settings: JSON-stringified settings\n * @param {string} requestId\n */\nasync function onApplySettings(settings, requestId) {\n // Apply settings\n const validSettings = TKHQ.applySettings(settings);\n\n // Persist in local storage\n TKHQ.setSettings(validSettings);\n\n // Send up SETTINGS_APPLIED message\n TKHQ.sendMessageUp(\"SETTINGS_APPLIED\", true, requestId);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".bundle.\" + {\"291\":\"b62abe64ba4ebf68e89b\",\"825\":\"3a4aff0e743a7540fe25\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t57: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkimport\"] = self[\"webpackChunkimport\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96,551], () => (__webpack_require__(954)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","_OverloadYield","k","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","window","TKHQ","iframeMessagePort","messageListenerController","AbortController","turnkeyInitController","messageEventListener","_ref","_regeneratorRuntime","mark","_callee","event","wrap","_context","prev","next","data","onInjectImportBundle","t0","toString","onExtractWalletEncryptedBundle","t1","onExtractKeyEncryptedBundle","t2","onApplySettings","t3","stop","_x","validateMnemonic","mnemonic","includes","Error","_x3","_x4","_x5","_x6","_onInjectImportBundle","_callee5","bundle","organizationId","userId","requestId","targetPublicBuf","bundleObj","signedData","targetPublicKeyJwk","_context5","JSON","parse","version","dataSignature","enclaveQuorumPublic","sent","concat","TextDecoder","decode","console","warn","targetPublic","abrupt","Uint8Array","_x7","_onExtractWalletEncryptedBundle","_callee6","plaintext","passphrase","combined","plaintextBuf","encryptedBundle","_context6","document","getElementById","trim","TextEncoder","encode","HpkeEncrypt","receiverPubJwk","_x8","_x9","_onExtractKeyEncryptedBundle","_callee7","keyFormat","_context7","_x10","_x11","_onApplySettings","_callee8","settings","validSettings","_context8","addEventListener","_callee3","styleSettings","plaintextTextarea","_context3","capture","signal","aborted","_callee2","permStatus","_context2","navigator","permissions","query","name","state","clipboard","writeText","_ref4","_callee4","_event$ports","_context4","ports","abort","onmessage","_x2","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","key","splice","obj","mode","this","__esModule","ns","def","current","indexOf","getOwnPropertyNames","forEach","definition","get","chunkId","all","reduce","promises","miniCssF","g","globalThis","Function","prop","hasOwnProperty","url","push","script","needAttach","scripts","getElementsByTagName","s","getAttribute","createElement","charset","nc","setAttribute","src","onScriptComplete","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","type","target","head","appendChild","installedChunks","installedChunkData","promise","reject","error","errorType","realSrc","message","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""}
\ No newline at end of file
diff --git a/import/dist/index.html b/import/dist/index.html
index b390360..0e88d04 100644
--- a/import/dist/index.html
+++ b/import/dist/index.html
@@ -1 +1 @@
-Turnkey Import
\ No newline at end of file
+Turnkey Import Mnemonic: Passphrase:
\ No newline at end of file
diff --git a/import/src/index.js b/import/src/index.js
index df90378..6898e78 100644
--- a/import/src/index.js
+++ b/import/src/index.js
@@ -12,6 +12,9 @@ var iframeMessagePort = null;
const messageListenerController = new AbortController();
const turnkeyInitController = new AbortController();
+// Guard to prevent concurrent channel establishment from multiple senders
+let channelEstablished = false;
+
/**
* Message Event Handlers to process messages from the parent frame
*/
@@ -120,6 +123,15 @@ window.addEventListener(
event.data["type"] == "TURNKEY_INIT_MESSAGE_CHANNEL" &&
event.ports?.[0]
) {
+ // Synchronously check-and-set the flag before any await. This prevents
+ // a second concurrent invocation from racing through while the first is
+ // suspended at an await, which would allow multiple origins to establish
+ // a channel before turnkeyInitController.abort() is reached.
+ if (channelEstablished) {
+ return;
+ }
+ channelEstablished = true;
+
// remove the message event listener that was added in the DOMContentLoaded event
messageListenerController.abort();