From 2e6faf69e62274a35611eb20b0e0a05251c4a8cd Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Fri, 20 Jun 2025 19:30:46 +0700 Subject: fix: generate correct keys for shadowsocks inbounds --- web/assets/js/util/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'web/assets/js/util') diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js index 0d869af6..c40e02c4 100644 --- a/web/assets/js/util/index.js +++ b/web/assets/js/util/index.js @@ -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); -- cgit v1.2.3