Fix crypto lib call crash with custom function
This commit is contained in:
		
							parent
							
								
									8116b50d50
								
							
						
					
					
						commit
						743c7e8bfb
					
				@ -1,7 +1,7 @@
 | 
				
			|||||||
import { Component, OnInit, OnDestroy, Output, EventEmitter, Input, ChangeDetectorRef, SimpleChanges, HostListener } from '@angular/core';
 | 
					import { Component, OnInit, OnDestroy, Output, EventEmitter, Input, ChangeDetectorRef, SimpleChanges, HostListener } from '@angular/core';
 | 
				
			||||||
import { Subscription, tap, of, catchError, Observable, switchMap } from 'rxjs';
 | 
					import { Subscription, tap, of, catchError, Observable, switchMap } from 'rxjs';
 | 
				
			||||||
import { ServicesApiServices } from '../../services/services-api.service';
 | 
					import { ServicesApiServices } from '../../services/services-api.service';
 | 
				
			||||||
import { nextRoundNumber } from '../../shared/common.utils';
 | 
					import { nextRoundNumber, simpleRandomUUID } from '../../shared/common.utils';
 | 
				
			||||||
import { StateService } from '../../services/state.service';
 | 
					import { StateService } from '../../services/state.service';
 | 
				
			||||||
import { AudioService } from '../../services/audio.service';
 | 
					import { AudioService } from '../../services/audio.service';
 | 
				
			||||||
import { ETA, EtaService } from '../../services/eta.service';
 | 
					import { ETA, EtaService } from '../../services/eta.service';
 | 
				
			||||||
@ -130,7 +130,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
 | 
				
			|||||||
    private authService: AuthServiceMempool,
 | 
					    private authService: AuthServiceMempool,
 | 
				
			||||||
    private enterpriseService: EnterpriseService,
 | 
					    private enterpriseService: EnterpriseService,
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    this.accelerationUUID = window.crypto.randomUUID();
 | 
					    this.accelerationUUID = simpleRandomUUID();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
 | 
				
			|||||||
@ -182,3 +182,16 @@ export function uncompressDeltaChange(delta: MempoolBlockDeltaCompressed): Mempo
 | 
				
			|||||||
    }))
 | 
					    }))
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function simpleRandomUUID(): string {
 | 
				
			||||||
 | 
					  const hexDigits = '0123456789abcdef';
 | 
				
			||||||
 | 
					  const uuidLengths = [8, 4, 4, 4, 12];
 | 
				
			||||||
 | 
					  let uuid = '';
 | 
				
			||||||
 | 
					  for (const length of uuidLengths) {
 | 
				
			||||||
 | 
					      for (let i = 0; i < length; i++) {
 | 
				
			||||||
 | 
					          uuid += hexDigits[Math.floor(Math.random() * 16)];
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      uuid += '-';
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return uuid.slice(0, -1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user