mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
fix: Error when generating shadowsocks keys in Blake3_AES_256_GCM (#2899)
This commit is contained in:
parent
aab01ff11a
commit
f21276e59f
1 changed files with 10 additions and 2 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue