feat(uuid): implement UUID generation for non-secure contexts and replace crypto.randomUUID() usage
This commit is contained in:
@@ -3,6 +3,7 @@ import { HttpErrorResponse, HttpEventType, HttpHeaders, HttpParams } from '@angu
|
||||
import { map, filter, Observable, tap } from 'rxjs';
|
||||
import { HttpService } from '../http-request/http.service';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { uuid } from '../../shared/utils/uuid';
|
||||
import {
|
||||
DocumentDetail,
|
||||
DocumentListParams,
|
||||
@@ -34,7 +35,7 @@ export class DocumentsService {
|
||||
* (from the login/`/me` flow) and a per-request correlation id.
|
||||
*/
|
||||
private csrfHeaders(): Record<string, string> {
|
||||
const headers: Record<string, string> = { 'X-Request-ID': crypto.randomUUID() };
|
||||
const headers: Record<string, string> = { 'X-Request-ID': uuid() };
|
||||
const token = this.auth.getCsrfToken();
|
||||
if (token) {
|
||||
headers['X-CSRF-Token'] = token;
|
||||
@@ -91,7 +92,7 @@ export class DocumentsService {
|
||||
title: string | undefined,
|
||||
onProgress: (percent: number) => void,
|
||||
signal?: AbortSignal,
|
||||
idempotencyKey: string = crypto.randomUUID(),
|
||||
idempotencyKey: string = uuid(),
|
||||
): Observable<DocumentUploadResult> {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
@@ -123,7 +124,7 @@ export class DocumentsService {
|
||||
submitReviewDecision(
|
||||
documentId: string,
|
||||
request: ReviewDecisionRequest,
|
||||
idempotencyKey: string = crypto.randomUUID(),
|
||||
idempotencyKey: string = uuid(),
|
||||
): Observable<ReviewDecisionResponse> {
|
||||
return this.http.postRaw<ReviewDecisionResponse>(
|
||||
`${API}/documents/${encodeURIComponent(documentId)}/extraction-review/decisions`,
|
||||
@@ -147,7 +148,7 @@ export class DocumentsService {
|
||||
/** D04 — retry processing of a document. */
|
||||
retryDocument(
|
||||
documentId: string,
|
||||
idempotencyKey: string = crypto.randomUUID(),
|
||||
idempotencyKey: string = uuid(),
|
||||
): Observable<RetryResult> {
|
||||
return this.http.postRaw<RetryResult>(
|
||||
`${API}/documents/${encodeURIComponent(documentId)}/retry`,
|
||||
|
||||
Reference in New Issue
Block a user