From ad102cc76c9d981ce6f07c08e857ac351f77deab Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 26 Nov 2024 05:41:04 -0800 Subject: [PATCH] Look into replacing Node test runner with browser-based tool. Remove Node workarounds from workers. --- src/lib/workers.ts | 2 +- src/lib/workers/ckdBip44.ts | 9 --------- src/lib/workers/ckdBlake2b.ts | 10 ---------- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/lib/workers.ts b/src/lib/workers.ts index 8828c7d..20feaa3 100644 --- a/src/lib/workers.ts +++ b/src/lib/workers.ts @@ -1,5 +1,5 @@ import ckdBip44 from './workers/ckdBip44.js' import ckdBlake2b from './workers/ckdBlake2b.js' -export { ckdBip44, ckdBlake2b } // import './workers/nano-nacl.js' // import './workers/passkey.js' +export { ckdBip44, ckdBlake2b } diff --git a/src/lib/workers/ckdBip44.ts b/src/lib/workers/ckdBip44.ts index 56a48c7..95b3b9b 100644 --- a/src/lib/workers/ckdBip44.ts +++ b/src/lib/workers/ckdBip44.ts @@ -10,15 +10,6 @@ const BIP44_COIN_NANO = 165 const BIP44_PURPOSE = 44 const HARDENED_OFFSET = 0x80000000 const SLIP10_ED25519 = 'ed25519 seed' -let addEventListener = globalThis.addEventListener -let postMessage = globalThis.postMessage -if (addEventListener == null || postMessage == null) { - const { isMainThread, parentPort } = await import('node:worker_threads') - if (!isMainThread && parentPort) { - addEventListener = Object.getPrototypeOf(parentPort).addListener.bind(parentPort) - postMessage = Object.getPrototypeOf(parentPort).postMessage.bind(parentPort) - } -} /** * Listens for messages from a calling function. diff --git a/src/lib/workers/ckdBlake2b.ts b/src/lib/workers/ckdBlake2b.ts index 10a477d..6f27858 100644 --- a/src/lib/workers/ckdBlake2b.ts +++ b/src/lib/workers/ckdBlake2b.ts @@ -3,16 +3,6 @@ import blake2b from 'blake2b' -let addEventListener = globalThis.addEventListener -let postMessage = globalThis.postMessage -if (addEventListener == null || postMessage == null) { - const { isMainThread, parentPort } = await import('node:worker_threads') - if (!isMainThread && parentPort) { - addEventListener = Object.getPrototypeOf(parentPort).addListener.bind(parentPort) - postMessage = Object.getPrototypeOf(parentPort).postMessage.bind(parentPort) - } -} - /** * Listens for messages from a calling function. */ -- 2.34.1