Skip to content

Commit 8942722

Browse files
committed
fix: use standard base64 encoding for Shadowsocks 2022 passwords
1 parent 9ce55e5 commit 8942722

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

dashboard/src/components/dialogs/CoreConfigModal.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface ValidationResult {
5454
}
5555
// Add encryption methods enum
5656
const SHADOWSOCKS_ENCRYPTION_METHODS = [
57-
{ value: '2022-blanke3-aes-128-gcm', label: '2022-blanke3-aes-128-gcm', length: 16 },
57+
{ value: '2022-blake3-aes-128-gcm', label: '2022-blake3-aes-128-gcm', length: 16 },
5858
{ value: '2022-blake3-aes-256-gcm', label: '2022-blake3-aes-256-gcm', length: 32 },
5959
] as const
6060
type VlessVariant = 'x25519' | 'mlkem768'
@@ -293,10 +293,8 @@ export default function CoreConfigModal({ isDialogOpen, onOpenChange, form, edit
293293

294294
const randomBytes = new Uint8Array(method.length)
295295
crypto.getRandomValues(randomBytes)
296+
// Shadowsocks 2022 requires standard base64 encoding (not URL-safe)
296297
const password = btoa(String.fromCharCode(...randomBytes))
297-
.replace(/\+/g, '-')
298-
.replace(/\//g, '_')
299-
.replace(/=/g, '')
300298
setGeneratedShadowsocksPassword({ password, encryptionMethod: method.label })
301299
showResultDialog('shadowsocksPassword', { password, encryptionMethod: method.label })
302300
toast.success(t('coreConfigModal.shadowsocksPasswordGenerated'))

0 commit comments

Comments
 (0)