File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,18 +37,20 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
3737 }
3838 } catch ( err ) { }
3939
40- // Use getRandomValues method
41- if ( crypto && typeof crypto . getRandomValues === 'function' ) {
42- try {
43- return crypto . getRandomValues ( new Uint32Array ( 1 ) ) [ 0 ] ;
44- } catch ( err ) { }
45- }
40+ if ( crypto ) {
41+ // Use getRandomValues method
42+ if ( typeof crypto . getRandomValues === 'function' ) {
43+ try {
44+ return crypto . getRandomValues ( new Uint32Array ( 1 ) ) [ 0 ] ;
45+ } catch ( err ) { }
46+ }
4647
47- // Use randomBytes method
48- if ( crypto && typeof crypto . randomBytes === 'function' ) {
49- try {
50- return crypto . randomBytes ( 4 ) . readInt32LE ( ) ;
51- } catch ( err ) { }
48+ // Use randomBytes method
49+ if ( typeof crypto . randomBytes === 'function' ) {
50+ try {
51+ return crypto . randomBytes ( 4 ) . readInt32LE ( ) ;
52+ } catch ( err ) { }
53+ }
5254 }
5355
5456 throw new Error ( 'Native crypto module could not be used to get secure random number.' ) ;
You can’t perform that action at this time.
0 commit comments