diff options
Diffstat (limited to 'web/assets/js/util/index.js')
| -rw-r--r-- | web/assets/js/util/index.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js index cc7b9287..1f481c85 100644 --- a/web/assets/js/util/index.js +++ b/web/assets/js/util/index.js @@ -152,6 +152,12 @@ class RandomUtil { return Base64.alternativeEncode(String.fromCharCode(...array)); } + static randomBase64(length = 16) { + const array = new Uint8Array(length); + window.crypto.getRandomValues(array); + return Base64.alternativeEncode(String.fromCharCode(...array)); + } + static randomBase32String(length = 16) { const array = new Uint8Array(length); |
