Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add enrollment gate check (#2334)
Leendert de Borstc49cdb8e10dd
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/keystoreprovider/AndroidKeystoreProvider.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/keystoreprovider/AndroidKeystoreProvider.ktindex 31a9ef394..f393cbc15 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/keystoreprovider/AndroidKeystoreProvider.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/keystoreprovider/AndroidKeystoreProvider.kt@@ -168,6 +168,15 @@ class AndroidKeystoreProvider(override fun storeKey(key: String, callback: KeystoreOperationCallback) {_mainHandler.post {try {+ if (!isStrongBiometricAvailable(context)) {+ callback.onError(+ AppError.BiometricNotAvailable(+ "Device has no strong (Class 3) biometrics available",+ ),+ )+ return@post+ }+val currentActivity = getCurrentActivity()if (currentActivity == null || !(currentActivity is FragmentActivity)) {callback.onError(diff --git a/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx b/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsxindex c69b8aeb4..a9bc05a1e 100644--- a/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx+++ b/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx@@ -82,11 +82,10 @@ export default function VaultUnlockSettingsScreen() : React.ReactNode {text: t('settings.openSettings'),style: 'default',/**- * Handle the open settings press.+ * Handle the open settings press. Biometrics stay disabled until the user has+ * actually enrolled one that works, which is re-checked when this screen reloads.*/onPress: async () : Promise<void> => {- await AppUnlockUtility.enableAuthMethod('faceid');- setIsBiometricsEnabled(true);if (Platform.OS === 'ios') {Linking.openURL('app-settings:');} else {diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.jsonindex 2a29e9e7e..fdc7f8c6a 100644--- a/apps/mobile-app/i18n/locales/en.json+++ b/apps/mobile-app/i18n/locales/en.json@@ -226,7 +226,7 @@"biometricDisabledMessage": "{{biometric}} is disabled for AliasVault. In order to use it, please enable it in your device settings first.","biometricHelp": "Use biometrics to unlock your vault, which is secured by the {{keystore}}.","biometricUnavailableHelp": "{{biometric}} is not available. Tap to open settings and/or go to your device settings to enable and configure it.",- "biometricUnavailableHelpAndroid": "Strong biometrics are not available. Android requires a strong (Class 3) biometric to protect your vault key: a fingerprint, or face unlock on devices where it is secure enough. You can use a PIN code instead.",+ "biometricUnavailableHelpAndroid": "Biometrics are not available for your device. Android requires strong (Class 3) biometrics, such as a fingerprint or supported secure face recognition.","featureRequiresPasscode": "This feature requires a passcode to be enabled on your device.","pin": "PIN Code","pinDescription": "Use a custom PIN code to unlock your vault more quickly.",diff --git a/apps/mobile-app/utils/AppUnlockUtility.ts b/apps/mobile-app/utils/AppUnlockUtility.tsindex 4d90994c1..8fccdda64 100644--- a/apps/mobile-app/utils/AppUnlockUtility.ts+++ b/apps/mobile-app/utils/AppUnlockUtility.ts@@ -39,7 +39,17 @@ export class AppUnlockUtility {*/static async setAuthMethods(methods: AuthMethod[]): Promise<void> {// Ensure password is always included- const methodsToSave = methods.includes('password') ? methods : [...methods, 'password'];+ let methodsToSave = methods.includes('password') ? methods : [...methods, 'password'];++ /*+ * Never persist biometrics on a device that cannot use them. The native keystore key+ * requires strong (Class 3) biometrics, so storing it would fail and leave the setting+ * enabled while unlocking silently falls back to PIN or password.+ */+ if (methodsToSave.includes('faceid') && !await this.isBiometricsAvailableOnDevice()) {+ console.warn('Biometrics not available on this device, not enabling as auth method');+ methodsToSave = methodsToSave.filter(method => method !== 'faceid');+ }// Update native credentials managertry {