import { Pool } from './pool.js'\r
import { Rpc } from './rpc.js'\r
import { Safe } from './safe.js'\r
-import { ckdBip44, nanoNacl } from './workers.js'\r
+import { ckdBip44, NanoNaCl } from './workers.js'\r
import type { Ledger } from './ledger.js'\r
\r
type KeyPair = {\r
? new Entropy(id)\r
: new Entropy(16)\r
this.#mnemonic = mnemonic ?? null\r
- this.#pool = new Pool(`(${nanoNacl})(${Blake2b})`)\r
+ this.#pool = new Pool(`const Blake2b = ${Blake2b}\n${NanoNaCl}`)\r
this.#safe = new Safe()\r
this.#seed = seed ?? null\r
}\r
import ckdBip44 from './workers/ckdBip44.js'
-import nanoNacl from './workers/nano-nacl.js'
+import NanoNaCl from './workers/nano-nacl.js'
// import './workers/passkey.js'
-export { ckdBip44, nanoNacl }
+export { ckdBip44, NanoNaCl }
chainCode: DataView
}
-async function fn () {
+const Bip44Ckd = () => {
const BIP44_COIN_NANO = 165
const BIP44_PURPOSE = 44
const HARDENED_OFFSET = 0x80000000
}
}
-export default `(${fn.toString()})()`
+export default Bip44Ckd.toString().substring(Bip44Ckd.toString().indexOf('{') + 1, Bip44Ckd.toString().lastIndexOf('}'))
// See for details: https://docs.nano.org/integration-guides/the-basics/\r
// Original source commit: https://github.com/dchest/tweetnacl-js/blob/71df1d6a1d78236ca3e9f6c788786e21f5a651a6/nacl-fast.js\r
\r
-import type { Blake2b } from '../blake2b.js'\r
-\r
-async function NanoNaCl (Blake2b: Blake2b) {\r
+const NanoNaCl = () => {\r
/**\r
* Listens for messages from a calling function.\r
*/\r
postMessage({ publicKey, privateKey, index })\r
})\r
\r
-\r
- var gf = function (init?: any) {\r
+ var gf = function (init?: number[]) {\r
var i, r = new Float64Array(16)\r
if (init) for (i = 0; i < init.length; i++) r[i] = init[i]\r
return r\r
const seedLength = crypto_sign_SEEDBYTES\r
const signatureLength = crypto_sign_BYTES\r
\r
+ return { sign, open, detached, verify, keyPair }\r
}\r
\r
-export const nacl = {\r
- sign: NanoNaCl.sign,\r
- open: NanoNaCl.open,\r
- detached: NanoNaCl.detached,\r
- verify: NanoNaCl.verify,\r
- keyPair: NanoNaCl.keyPair\r
-}\r
-export default NanoNaCl.toString()\r
+export const nacl = NanoNaCl()\r
+\r
+export default NanoNaCl.toString().substring(NanoNaCl.toString().indexOf('{') + 1, NanoNaCl.toString().lastIndexOf('return'))\r