import { base32, bytes, hex } from './convert.js'\r
import { Rpc } from './rpc.js'\r
import { Safe } from './safe.js'\r
-import { NanoNaCl } from './nano-nacl.js'\r
+import { NanoNaCl } from './workers/nano-nacl.js'\r
\r
/**\r
* Represents a single Nano address and the associated public key. To include the\r
return false\r
}\r
\r
- const entropy = new Entropy(bin.toBytes(entropyBits))\r
+ const entropy = await Entropy.import(bin.toBytes(entropyBits))\r
const expectedChecksum = await this.checksum(entropy)\r
\r
if (expectedChecksum !== checksumBits) {\r
import { Account } from './account.js'
import { Blake2b } from './blake2b.js'
import { dec, hex } from './convert.js'
-import { NanoNaCl } from './nano-nacl.js'
+import { NanoNaCl } from './workers/nano-nacl.js'
import { Pool } from './pool.js'
import { Rpc } from './rpc.js'
import { Pow } from './workers.js'
throw new Error(ERR_MSG)
}
- const iv = new Entropy()
+ const iv = await Entropy.create()
if (typeof passkey === 'string') {
try {
passkey = await subtle.importKey('raw', utf8.toBytes(passkey), 'PBKDF2', false, ['deriveBits', 'deriveKey'])
}
const record = JSON.parse(item)
const encrypted = hex.toBytes(record.encrypted)
- const iv = new Entropy(record.iv)
+ const iv = await Entropy.import(record.iv)
try {
if (typeof passkey === 'string') {
import { Rpc } from './rpc.js'
import { Bip44Wallet, Blake2bWallet, LedgerWallet } from './wallet.js'
import { SendBlock } from './block.js'
-import { NanoNaCl } from './nano-nacl.js'
+import { NanoNaCl } from './workers/nano-nacl.js'
function hash (data: string | string[], encoding?: 'hex'): string {
if (!Array.isArray(data)) data = [data]
let results = await this.ckd(indexes)\r
const data: any = []\r
results.forEach(r => data.push({ privateKey: r.privateKey, index: r.index }))\r
- const pool = new Pool(`const Blake2b = ${Blake2b}\n${NanoNaCl}`)\r
+ const pool = new Pool(NanoNaCl)\r
const keypairs: KeyPair[] = await pool.work('divide', data)\r
pool.dismiss()\r
for (const keypair of keypairs) {\r
\r
'use strict'\r
\r
-import { Blake2b } from '#src/lib/blake2b.js'\r
+import { Blake2b } from '../blake2b.js'\r
\r
// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.\r
// Public domain.\r
\r
const start = n.toString().indexOf('{') + 1\r
const end = n.toString().lastIndexOf('return')\r
-export const worker = n.toString().substring(start, end)\r
+const blake2b = `const Blake2b = ${Blake2b}\n`\r
+export const worker = `${blake2b}${n.toString().substring(start, end)}`\r