Web3.js: web3.eth.accounts.decrypt: createDecipheriv is not a function

Created on 23 Sep 2017  Â·  9Comments  Â·  Source: ChainSafe/web3.js

I get "TypeError: crypto.createDecipheriv is not a function" when I try to do web3.eth.accounts.decrypt. A possible fix: https://github.com/nwjs/nw.js/issues/880

ERROR TypeError: crypto.createDecipheriv is not a function
at Accounts.webpackJsonp.../../../../web3-eth-accounts/src/index.js.Accounts.decrypt (index.js:252)
at FileReader.myReader.onloadend (

bug

Most helpful comment

The next version will have crypto-browserify as well.

All 9 comments

Can you please test if the latest 1.0 branch fixes that?

will release a version beta.22 today, please test

Ok, I will test it, thanks

2017-09-25 17:50 GMT+03:00 Fabian Vogelsteller notifications@github.com:

will release a version beta.22 today, please test

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/ethereum/web3.js/issues/1071#issuecomment-331906056,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJoaYQegHEYHyQDqQ9hPOfFyKThewQoDks5sl73AgaJpZM4Phg3Y
.

I still get core.es5.js:1020 ERROR TypeError: cryp.createDecipheriv is not a function
at Accounts.webpackJsonp.../../../../web3-eth-accounts/src/index.js.Accounts.decrypt (index.js:252)

I still get the same error

Found the problem, it should be crypto = require('crypto-browserify'); instead of crypto = require('crypto');

Hi !
I get another error when using the method web3.eth.accounts.encrypt(privateKey, password);
The source of the error is the same that @narcis2007 commented about.

core.es5.js:1020 ERROR Error: Uncaught (in promise): TypeError: cryp.randomBytes is not a function TypeError: cryp.randomBytes is not a function at Accounts.webpackJsonp.../../../../web3-eth-accounts/src/index.js.Accounts.encrypt (index.js:263) at signUpService.signUp.then.namespace (sign-up.component.ts:60) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:365) at Object.onInvoke (core.es5.js:3890) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:364) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (zone.js:125) at zone.js:760 at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:398) at Object.onInvokeTask (core.es5.js:3881) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:397) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:165) at drainMicroTaskQueue (zone.js:593) at XMLHttpRequest.ZoneTask.invoke (zone.js:464) at Accounts.webpackJsonp.../../../../web3-eth-accounts/src/index.js.Accounts.encrypt (index.js:263) at signUpService.signUp.then.namespace (sign-up.component.ts:60) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:365) at Object.onInvoke (core.es5.js:3890) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:364) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (zone.js:125) at zone.js:760 at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:398) at Object.onInvokeTask (core.es5.js:3881) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:397) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:165) at drainMicroTaskQueue (zone.js:593) at XMLHttpRequest.ZoneTask.invoke (zone.js:464) at Object.onInvokeTask (core.es5.js:3881) [angular]

Definitely there is something wrong with var cryp = require('crypto');, because I did also changed to var cryp = require('crypto-browserify'); and it worked !

Do you have any update on that, @frozeman ?

Thanks in advance !

Hello,
I got the same error with : web3.eth.accounts.encrypt(privateKey, password);
I use this version 1.0.0-beta.26

The next version will have crypto-browserify as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TinyWJL picture TinyWJL  Â·  3Comments

dhl picture dhl  Â·  3Comments

FradSer picture FradSer  Â·  3Comments

xpepermint picture xpepermint  Â·  3Comments

SCBuergel picture SCBuergel  Â·  3Comments