diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-03-09 09:09:42 +0300 |
|---|---|---|
| committer | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-03-09 09:09:42 +0300 |
| commit | 64fa0e97a30eb8f21b37f358b6382abcb4e4d9f2 (patch) | |
| tree | 4e5e050df573dfec987186e179689b2a30355923 /web/assets | |
| parent | a45e9de47256710020cdf6ee0e21d88102979616 (diff) | |
chore: use `crypto.randomUUID()` for generating UUIDv4
Diffstat (limited to 'web/assets')
| -rw-r--r-- | web/assets/js/util/index.js | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js index cecc8dd4..0fea0592 100644 --- a/web/assets/js/util/index.js +++ b/web/assets/js/util/index.js @@ -126,14 +126,7 @@ class RandomUtil { } static randomUUID() { - const template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'; - return template.replace(/[xy]/g, function (c) { - const randomValues = new Uint8Array(1); - crypto.getRandomValues(randomValues); - let randomValue = randomValues[0] % 16; - let calculatedValue = (c === 'x') ? randomValue : (randomValue & 0x3 | 0x8); - return calculatedValue.toString(16); - }); + return window.crypto.randomUUID() } static randomShadowsocksPassword() { |
