From d0fe055af6b7081e46c1d97674a04e23857c74cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 16 Aug 2023 15:39:55 +0200 Subject: [PATCH] Always allow setting a password MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/e2ee/sharedKeyManagement.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/e2ee/sharedKeyManagement.ts b/src/e2ee/sharedKeyManagement.ts index 819c16d9..3af56d6f 100644 --- a/src/e2ee/sharedKeyManagement.ts +++ b/src/e2ee/sharedKeyManagement.ts @@ -26,12 +26,12 @@ export const getRoomSharedKeyLocalStorageKey = (roomId: string): string => export const useInternalRoomSharedKey = ( roomId: string -): [string | null, ((value: string) => void) | null] => { +): [string | null, (value: string) => void] => { const key = useMemo(() => getRoomSharedKeyLocalStorageKey(roomId), [roomId]); const [e2eeEnabled] = useEnableE2EE(); const [roomSharedKey, setRoomSharedKey] = useLocalStorage(key); - return e2eeEnabled ? [roomSharedKey, setRoomSharedKey] : [null, null]; + return [e2eeEnabled ? roomSharedKey : null, setRoomSharedKey]; }; export const useRoomSharedKey = (roomId: string): string | null => { @@ -47,7 +47,7 @@ export const useManageRoomSharedKey = (roomId: string): string | null => { if (password === "") return; if (password === e2eeSharedKey) return; - setE2EESharedKey?.(password); + setE2EESharedKey(password); }, [password, e2eeSharedKey, setE2EESharedKey]); useEffect(() => {