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
This commit is contained in:
Jamie Brunton committed 2026-01-02 09:13:24 +00:00
1 parent 5a7488bd62
commit d62fd1c053
2 files changed
+21 -2

No files matched your search

+3
View File
@@ -54,3 +54,6 @@ coverage/
.tmp/
*.tmp
nul
# Opencode
.opencode/
@@ -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.`);