Skip to content

Commit 929f4fb

Browse files
committed
crypto patch
1 parent a78f162 commit 929f4fb

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/utils/uuid.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export function generateUUID(): string {
44
}
55

66
// Fallback (non cryptographique)
7-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c: string) {
8-
const r = (Math.random() * 16) | 0;
9-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
7+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c: string): string {
8+
const r = Math.floor(Math.random() * 16); // évite l'opérateur bitwise
9+
const v = c === 'x' ? r : (r % 4) + 8; // remplace (r & 0x3 | 0x8)
1010
return v.toString(16);
1111
});
1212
}

tslint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"label-position": true,
1515
"no-any": true,
1616
"no-arg": true,
17-
"no-bitwise": false,
17+
"no-bitwise": true,
1818
"no-console": [
1919
false,
2020
"log",

0 commit comments

Comments
 (0)