ethereumjs / keythereum

Create, import and export Ethereum keys
MIT License
609 stars 163 forks source link

TypeError: crypto.randomBytes is not a function #43

Closed thackerronak closed 6 years ago

thackerronak commented 6 years ago

"angular/compiler-cli": "^4.2.4", "typescript": "~2.3.3"

var dk = keythereum.create(this.params);

"scripts": [ "assets/keythereum.min.js", "assets/keythereum.js" ],

AppComponent.html:7 ERROR TypeError: crypto.randomBytes is not a function
    at Object.create (index.js:304)
    at AppComponent.webpackJsonp.../../../../../src/app/app.component.ts.AppComponent.generateWallet (app.component.ts:24)
    at Object.eval [as handleEvent] (AppComponent.html:7)
    at handleEvent (core.es5.js:12023)
    at callWithDebugContext (core.es5.js:13493)
    at Object.debugHandleEvent [as handleEvent] (core.es5.js:13081)
    at dispatchEvent (core.es5.js:8615)
    at core.es5.js:9226
    at HTMLButtonElement.<anonymous> (platform-browser.es5.js:2651)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
thackerronak commented 6 years ago

issue solved with change crypto lib to browserify-aes in index.js file var randomBytes = require('randombytes'); // var crypto = require("crypto"); var crypto = require('browserify-aes');

ChenLiheng commented 6 years ago

Hi,An error occurred when I created the key. Error: secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 11

Silur commented 6 years ago

@ChenLiheng cannot describe the problem better than your browser, secure RNG is implementation dependent, you shouldn't use a browser that's not capable doing that

ChenLiheng commented 6 years ago

@Silur If I have to use this browser, what should I do ? Is there any way to be compatible with these browsers?

tinybike commented 6 years ago

@ChenLiheng What versions of Chrome and Firefox are you using?