//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
//! SPDX-License-Identifier: GPL-3.0-or-later
-import * as nano25519 from 'nano25519'
+import { derive as nano25519_derive, sign as nano25519_sign } from 'nano25519'
import { parentPort } from 'node:worker_threads'
import { BIP44_COIN_NANO } from '../constants'
import { Bip39, Bip44, Blake2b, WalletAesGcm } from '../crypto'
const listener = (event: MessageEvent<any>): void => {
const { url, id } = event.data
- if (url !== location.href) return
+ BROWSER: if (url !== location.href) return
NODE: if (parentPort == null) setTimeout(() => listener(event), 0)
const data = _parseData(event.data)
const action = _parseAction(data)
: Blake2b.ckd(_seed, index)
return derive.then(result => {
const prv = new Uint8Array(result)
- const pub = nano25519.derive(prv)
+ const pub = nano25519_derive(prv)
_timer = new VaultTimer(() => lock(), _timeout)
return { index, publicKey: pub.buffer }
})
: Bip44.ckd(_type === 'Exodus' ? 'Bitcoin seed' : 'ed25519 seed', _seed, BIP44_COIN_NANO, index)
return derive.then(result => {
const prv = new Uint8Array(result)
- const pub = nano25519.derive(prv)
- const sig = nano25519.sign(new Uint8Array(data), new Uint8Array([...prv, ...pub]))
+ const pub = nano25519_derive(prv)
+ const sig = nano25519_sign(new Uint8Array(data), new Uint8Array([...prv, ...pub]))
_timer = new VaultTimer(() => lock(), _timeout)
return { signature: sig.buffer }
})