Skip to content

Commit 065cd2d

Browse files
Update extenstions.js
1 parent 5a8b897 commit 065cd2d

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

WebServerAI/assets/AI/js/components/extenstions.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,7 @@ class Extensions{
66
this.ext = {};
77
}
88
#extensionID(){
9-
// Create a buffer to hold random bytes
10-
const randomBytes = new Uint8Array(16);
11-
// Fill the buffer with cryptographically secure random values
12-
window.crypto.getRandomValues(randomBytes);
13-
14-
// Replace the placeholders in the UUID template with random hexadecimal characters
15-
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
16-
// Use random bytes to generate hexadecimal digits
17-
const r = randomBytes[Math.floor(Math.random() * randomBytes.length)];
18-
// Replace 'x' with a random digit and 'y' with a specific digit (4 for UUID version 4)
19-
return (c === 'x' ? (r & 0x0f) : (r & 0x3 | 0x8)).toString(16);
20-
});
21-
9+
const uuid = window.crypto.randomUUID();
2210
return uuid;
2311
}
2412
/**

0 commit comments

Comments
 (0)