File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,14 @@ function randomBytes (size, cb) {
1717 // phantomjs needs to throw
1818 if ( size > 65536 ) throw new Error ( 'requested too many random bytes' )
1919 // in case browserify isn't using the Uint8Array version
20- var rawBytes = new global . Uint8Array ( size )
20+ var bytes = Buffer . allocUnsafe ( size )
2121
2222 // This will not work in older browsers.
2323 // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
2424 if ( size > 0 ) { // getRandomValues fails on IE if size == 0
25- crypto . getRandomValues ( rawBytes )
25+ crypto . getRandomValues ( bytes )
2626 }
2727
28- // XXX: phantomjs doesn't like a buffer being passed here
29- var bytes = Buffer . from ( rawBytes . buffer )
30-
3128 if ( typeof cb === 'function' ) {
3229 return process . nextTick ( function ( ) {
3330 cb ( null , bytes )
You can’t perform that action at this time.
0 commit comments