From 22763fe8f64e8f48e1c07df95fcad391e30a7a3d Mon Sep 17 00:00:00 2001 From: mrchatam Date: Sat, 12 Sep 2026 12:38:21 +0330 Subject: [PATCH] feat(clients): add Generate button for WireGuard/AmneziaWG PresharedKey (#6455) * feat(clients): add Generate button for WireGuard/AmneziaWG PresharedKey Matches existing key regenerate controls on the client form. Value is 32 random bytes base64 via Wireguard.generatePresharedKey (same as wg genpsk). Field stays optional. Fixes #6343 * fix(clients): keep FormField for WireGuard PresharedKey generate Restore RHF FormField (noStyle inside Space.Compact) so the regenerate control matches inbound reality patterns and satisfies oxfmt. --------- Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com> --- .../src/pages/clients/ClientFormModal.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/clients/ClientFormModal.tsx b/frontend/src/pages/clients/ClientFormModal.tsx index e24c2c5a7..2ef3fc423 100644 --- a/frontend/src/pages/clients/ClientFormModal.tsx +++ b/frontend/src/pages/clients/ClientFormModal.tsx @@ -522,6 +522,10 @@ export default function ClientFormModal({ methods.setValue('wgPublicKey', kp.publicKey); } + function regenerateWireguardPresharedKey() { + methods.setValue('wgPreSharedKey', Wireguard.keyToBase64(Wireguard.generatePresharedKey())); + } + function regenerateMtprotoSecret() { methods.setValue('secret', generateMtprotoSecret(mtprotoDomain)); } @@ -1251,16 +1255,24 @@ export default function ClientFormModal({ > - - - + + + + +