fix: generate correct keys for shadowsocks inbounds

This commit is contained in:
Shishkevich D.
2025-06-20 19:30:46 +07:00
committed by GitHub
parent f88b7b07f0
commit 2e6faf69e6
4 changed files with 12 additions and 6 deletions
+8 -2
View File
@@ -138,8 +138,14 @@ class RandomUtil {
}
}
static randomShadowsocksPassword() {
const array = new Uint8Array(32);
static randomShadowsocksPassword(method = SSMethods.BLAKE3_AES_256_GCM) {
let length = 32;
if ([SSMethods.BLAKE3_AES_128_GCM].includes(method)) {
length = 16;
}
const array = new Uint8Array(length);
window.crypto.getRandomValues(array);