fix: Error when generating shadowsocks keys in Blake3_AES_256_GCM

This commit is contained in:
Shishkevich D. 2025-04-15 18:33:26 +07:00 committed by GitHub
parent aab01ff11a
commit 45c3d730d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -140,8 +140,10 @@ class RandomUtil {
static randomShadowsocksPassword() {
const array = new Uint8Array(32);
window.crypto.getRandomValues(array);
return Base64.encode(String.fromCharCode(...array));
return Base64.alternativeEncode(String.fromCharCode(...array));
}
}
@ -528,6 +530,12 @@ class Base64 {
)
}
static alternativeEncode(content) {
return window.btoa(
content
)
}
static decode(content = "") {
return new TextDecoder()
.decode(
@ -807,7 +815,7 @@ const MediaQueryMixin = {
}
class FileManager {
static downloadTextFile(content, filename='file.txt', options = { type: "text/plain" }) {
static downloadTextFile(content, filename = 'file.txt', options = { type: "text/plain" }) {
let link = window.document.createElement('a');
link.download = filename;