crypto-browserify icon indicating copy to clipboard operation
crypto-browserify copied to clipboard

function createPrivateKey missing

Open ankushKun opened this issue 7 months ago • 0 comments

I am working on a Lynx project and using their polyfills package which uses crypto-browserify for polyfilling the crypto package.

I am also using @permaweb/aoconnect package which relies on the createPrivateKey function from node:crypto, which seems to be missing from crypto-browserify, and results in the following error:

File: /Users/weeblet/Developer/ARWEAVE/FWD/subspace/mobileapp/node_modules/@permaweb/aoconnect/dist/index.js|react:main-thread:1:1
  × ESModulesLinkingError: export 'createPrivateKey' (imported as 'createPrivateKey') was not found in 'node:crypto' (possible exports: Cipher, Cipheriv, Decipher, Decipheriv, DiffieHellman, DiffieHellmanGroup, Hash, Hmac, Sign, Verify, constants, createCipher, createCipheriv, createCredentials, createDecipher, createDecipheriv, createDiffieHellman, createDiffieHellmanGroup, createECDH, createHash, createHmac, createSign, createVerify, getCiphers, getDiffieHellman, getHashes, listCiphers, pbkdf2, pbkdf2Sync, privateDecrypt, privateEncrypt, prng, pseudoRandomBytes, publicDecrypt, publicEncrypt, randomBytes, randomFill, randomFillSync, rng)
      ╭─[1876:23]
 1874 │ function createSigner(wallet) {
 1875 │     const publicKey = Buffer.from(wallet.n, "base64url");
 1876 │     const privateKey = createPrivateKey({
      ·                        ────────────────
 1877 │         key: wallet,
 1878 │         format: "jwk"
      ╰────

 @ ./src/App.tsx
 @ ./src/index.tsx

are there any plans for adding the missing function(s) to crypto-browserify?

Thanks

ankushKun avatar May 19 '25 13:05 ankushKun