From d62fd1c053aa24fe4a8aa5ccc1aefd9ee2f754ef Mon Sep 17 00:00:00 2001 From: Jamie Brunton Date: Fri, 2 Jan 2026 09:13:24 +0000 Subject: [PATCH] Verify identity when enabling biometric auth - Prompt for biometric authentication before enabling feature - Add error handling for failed authentication - Update .gitignore to exclude .opencode directory --- .gitignore | 3 +++ .../profile/hooks/useProfileSettings.ts | 20 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e79b70d..3492e0a 100755 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ coverage/ .tmp/ *.tmp nul + +# Opencode +.opencode/ diff --git a/apps/mobile/src/features/profile/hooks/useProfileSettings.ts b/apps/mobile/src/features/profile/hooks/useProfileSettings.ts index 2cc9ec5..3a6beee 100644 --- a/apps/mobile/src/features/profile/hooks/useProfileSettings.ts +++ b/apps/mobile/src/features/profile/hooks/useProfileSettings.ts @@ -277,11 +277,27 @@ export function useProfileSettings() { }; const handleBiometricToggle = async (value: boolean) => { - setBiometricEnabledState(value); setIsUpdatingBiometric(true); try { - await setBiometricEnabled(value); + if (value) { + const { authenticateWithBiometric } = await import('../../../lib/biometricAuth'); + const success = await authenticateWithBiometric(); + + if (!success) { + Alert.alert( + "Authentication Failed", + `Could not verify your ${biometricType}. Please try again.` + ); + return; + } + + await setBiometricEnabled(true); + setBiometricEnabledState(true); + } else { + await setBiometricEnabled(false); + setBiometricEnabledState(false); + } } catch (error) { setBiometricEnabledState(!value); Alert.alert("Error", `Failed to ${value ? "enable" : "disable"} ${biometricType}. Please try again.`);