Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7881

Cannot run generateKeyPair from @solana/web3.js@rc

$
0
0

I am trying to run the command const keyPair: CryptoKeyPair = await generateKeyPair() and I get the following error:

throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED);

Steps to reproduce

  1. I've created a new node js app
  2. I've installed the following:
"dependencies": {"@solana/web3.js": "^2.0.0-rc.0","buffer": "^6.0.3","chalk": "4.1.2","decimal.js": "^10.4.3","dotenv": "^16.4.5","viem": "^2.20.1"    },"devDependencies": {"@types/bn.js": "^5.1.0","@types/chai": "^4.3.0","@types/mocha": "^9.0.0","chai": "^4.3.4","mocha": "^9.0.3","prettier": "^2.6.2","ts-mocha": "^10.0.0","ts-node": "^10.9.1","tsconfig-paths": "^4.1.2","typescript": "^5.5.4"    }
  1. and then I have a simple file (in index.ts)
;(async() => {  const keyPair: CryptoKeyPair = await generateKeyPair();})()

Here are a few more details from the error:

/Users/mehrancastle/Desktop/dev/personal/controller-lite/node_modules/@solana/assertions/src/subtle-crypto.ts:49        throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED);              ^SolanaError: No key generation implementation could be found.    at Object.assertKeyGenerationIsAvailable (/Users/mehrancastle/Desktop/dev/personal/controller-lite/node_modules/@solana/assertions/src/subtle-crypto.ts:49:15)    at generateKeyPair (/Users/mehrancastle/Desktop/dev/personal/controller-lite/node_modules/@solana/keys/src/key-pair.ts:14:11)    at /Users/mehrancastle/Desktop/dev/personal/controller-lite/lib/controller/raw/index.ts:105:54    at Object.<anonymous> (/Users/mehrancastle/Desktop/dev/personal/controller-lite/lib/controller/raw/index.ts:130:3)    at Module._compile (node:internal/modules/cjs/loader:1256:14)    at Module.m._compile (/Users/mehrancastle/.config/yarn/global/node_modules/ts-node/src/index.ts:1618:23)    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)    at Object.require.extensions.<computed> [as .ts] (/Users/mehrancastle/.config/yarn/global/node_modules/ts-node/src/index.ts:1621:12)    at Module.load (node:internal/modules/cjs/loader:1119:32)    at Function.Module._load (node:internal/modules/cjs/loader:960:12) {  cause: undefined,  context: { __code: 3610004 }}

Viewing all articles
Browse latest Browse all 7881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>