From 32a553076460ad1ec4b8bbd0831880db3145a747 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 26 Jun 2026 13:25:18 -0700 Subject: [PATCH] Load worker messaging for async module independently of sync module. --- src/index.ts | 1 - src/lib/nano25519.ts | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 377ada4..4cc42f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,4 +3,3 @@ export { deriveAsync, signAsync, verifyAsync } from './async' export { derive, sign, verify } from './sync' - diff --git a/src/lib/nano25519.ts b/src/lib/nano25519.ts index 4043e76..30ab33b 100644 --- a/src/lib/nano25519.ts +++ b/src/lib/nano25519.ts @@ -178,7 +178,12 @@ const nano25519_init = (bytes: number[]): { derive: typeof derive, sign: typeof } return value as Uint8Array } + return { derive, sign, verify } +} + +export const nano25519 = nano25519_init(nano25519_wasm) +const nano25519_worker_init = ({ derive, sign, verify }: typeof nano25519) => { let isListening = false let host: NodeMessagePort | null = null let client: string | undefined = globalThis.location?.href @@ -274,13 +279,9 @@ const nano25519_init = (bytes: number[]): { derive: typeof derive, sign: typeof }) } } - - return { derive, sign, verify } } -export const nano25519 = nano25519_init(nano25519_wasm) - -const nano25519_worker = `;(${nano25519_init})([${nano25519_wasm}]);` +const nano25519_worker = `;(${nano25519_worker_init})((${nano25519_init})([${nano25519_wasm}]));` /** * Host code for asynchronous Web Worker -- 2.52.0