Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web3.eth.accounts.decrypt: createDecipheriv is not a function #1071

Closed
narcis2007 opened this issue Sep 23, 2017 · 9 comments
Closed

web3.eth.accounts.decrypt: createDecipheriv is not a function #1071

narcis2007 opened this issue Sep 23, 2017 · 9 comments
Labels
Bug Addressing a bug

Comments

@narcis2007
Copy link

narcis2007 commented Sep 23, 2017

I get "TypeError: crypto.createDecipheriv is not a function" when I try to do web3.eth.accounts.decrypt. A possible fix: nwjs/nw.js#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 (

@frozeman
Copy link
Contributor

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

@frozeman frozeman added the Bug Addressing a bug label Sep 25, 2017
@frozeman
Copy link
Contributor

will release a version beta.22 today, please test

@narcis2007
Copy link
Author

narcis2007 commented Sep 25, 2017 via email

@NarcisCiobotariu
Copy link

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)

@narcis2007
Copy link
Author

I still get the same error

@narcis2007
Copy link
Author

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

@AdrielGS
Copy link

AdrielGS commented Oct 5, 2017

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 !

@nicolaslawdune
Copy link
Contributor

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

@frozeman
Copy link
Contributor

The next version will have crypto-browserify as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

5 participants