ethereumjs/keythereum

TypeError: crypto.randomBytes is not a function

Closed this issue · 5 comments

"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)

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');

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

@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

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

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