Skip to content

Commit a78f162

Browse files
committed
crypto patch
1 parent 9b858cd commit a78f162

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

src/utils/uuid.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
21
export function generateUUID(): string {
3-
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
4-
return crypto.randomUUID();
5-
}
2+
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
3+
return crypto.randomUUID();
4+
}
65

7-
// Fallback (non cryptographique)
8-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
9-
const r = Math.random() * 16 | 0;
10-
const v = c === 'x' ? r : (r & 0x3 | 0x8);
11-
return v.toString(16);
12-
});
13-
}
6+
// 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;
10+
return v.toString(16);
11+
});
12+
}

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": true,
17+
"no-bitwise": false,
1818
"no-console": [
1919
false,
2020
"log",

0 commit comments

Comments
 (0)