fix: Error when generating shadowsocks keys in Blake3_AES_256_GCM (#2899)

This commit is contained in:
Shishkevich D. 2025-04-15 11:31:27 +00:00
parent aab01ff11a
commit f21276e59f

View file

@ -140,8 +140,10 @@ class RandomUtil {
static randomShadowsocksPassword() { static randomShadowsocksPassword() {
const array = new Uint8Array(32); const array = new Uint8Array(32);
window.crypto.getRandomValues(array); 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 = "") { static decode(content = "") {
return new TextDecoder() return new TextDecoder()
.decode( .decode(