@@ -88,7 +88,7 @@ var cryptoBytes = function cryptoBytes(count) {
88
88
return Buffer . from ( Crypto . randomBytes ( count ) ) ;
89
89
} ;
90
90
91
- var randomBytes = function randomBytes ( count ) {
91
+ var prngBytes = function prngBytes ( count ) {
92
92
var BYTES_USED_PER_RANDOM_CALL = 6 ;
93
93
var randCount = Math . ceil ( count / BYTES_USED_PER_RANDOM_CALL ) ;
94
94
@@ -132,7 +132,7 @@ var _class = function () {
132
132
throw new Error ( 'Invalid argument for Entropy constructor: Expect params object' ) ;
133
133
}
134
134
135
- if ( params . bits === undefined && params . charset === undefined && params . total === undefined && params . risk === undefined ) {
135
+ if ( params . bits === undefined && params . charset === undefined && params . total === undefined && params . risk === undefined && params . prng === undefined ) {
136
136
throw new Error ( 'Invalid Entropy params' ) ;
137
137
}
138
138
@@ -245,16 +245,8 @@ var _class = function () {
245
245
var charset = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : propMap . get ( this ) . charset ;
246
246
247
247
var bytesNeeded = charset . bytesNeeded ( bitLen ) ;
248
- return this . stringWithBytes ( cryptoBytes ( bytesNeeded ) , bitLen , charset ) ;
249
- }
250
- } , {
251
- key : 'stringPRNG' ,
252
- value : function stringPRNG ( ) {
253
- var bitLen = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : propMap . get ( this ) . bitLen ;
254
- var charset = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : propMap . get ( this ) . charset ;
255
-
256
- var bytesNeeded = charset . bytesNeeded ( bitLen ) ;
257
- return this . stringWithBytes ( randomBytes ( bytesNeeded ) , bitLen , charset ) ;
248
+ var bytes = propMap . get ( this ) . prng ? prngBytes ( bytesNeeded ) : cryptoBytes ( bytesNeeded ) ;
249
+ return this . stringWithBytes ( bytes , bitLen , charset ) ;
258
250
}
259
251
} , {
260
252
key : 'stringWithBytes' ,
0 commit comments