library-biometric: detekt clean (16 tests)
- Commit
0e45f8b2240c057d8fbfd09c1adfee42cbb7b10e- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-14 23:04 UTC (21 days ago)
- Parents
e61e193
Findings before: 2 (1 UndocumentedPublicClass warning, 1 UnusedParameter error). After: 0. - Added KDoc to BiometricDatabaseHelper explaining that its AES key is bound to biometric/device-credential authentication so the SQLCipher passphrase only unwraps after device unlock. - Renamed the Robolectric shadow's canAuthenticate parameter to detekt's allowed 'ignored' marker: the @Implementation signature is dictated by the framework BiometricManager and the shadow deliberately ignores the authenticator bitmask, always reporting the test-configured status. No suppression added. Verified: ./gradlew :library:biometric:detekt :library:biometric:testDebugUnitTest :library:biometric:lint --max-workers=32 all green (16 unit tests).
Diff
library/biometric/src/main/java/com/vayunmathur/library/biometric/BiometricDatabaseHelper.kt
diff --git a/library/biometric/src/main/java/com/vayunmathur/library/biometric/BiometricDatabaseHelper.kt b/library/biometric/src/main/java/com/vayunmathur/library/biometric/BiometricDatabaseHelper.ktindex 887a2b1485..78b354b992 100644--- a/library/biometric/src/main/java/com/vayunmathur/library/biometric/BiometricDatabaseHelper.kt+++ b/library/biometric/src/main/java/com/vayunmathur/library/biometric/BiometricDatabaseHelper.kt@@ -11,6 +11,11 @@ import com.vayunmathur.library.util.DatabaseHelper import javax.crypto.Cipher import javax.crypto.KeyGenerator +/**+ * Database key helper whose AES key is bound to biometric/device-credential+ * authentication, so the SQLCipher passphrase can only be unwrapped after the+ * user unlocks the device.+ */ class BiometricDatabaseHelper(context: Context) : DatabaseHelper(context) { override val keyStoreAlias = "db_auth_key" override val passphraseKey = "encrypted_passphrase"
library/biometric/src/test/java/com/vayunmathur/library/biometric/FrameworkShadows.kt
diff --git a/library/biometric/src/test/java/com/vayunmathur/library/biometric/FrameworkShadows.kt b/library/biometric/src/test/java/com/vayunmathur/library/biometric/FrameworkShadows.ktindex 163565fbfa..3d5b281f0a 100644--- a/library/biometric/src/test/java/com/vayunmathur/library/biometric/FrameworkShadows.kt+++ b/library/biometric/src/test/java/com/vayunmathur/library/biometric/FrameworkShadows.kt@@ -16,7 +16,9 @@ import org.robolectric.annotation.Implements @Implements(BiometricManager::class) class ShadowFrameworkBiometricManager { @Implementation- fun canAuthenticate(authenticators: Int): Int = statusToReturn+ // Parameter name is detekt's allowed marker for a framework-dictated+ // signature whose argument the shadow deliberately ignores.+ fun canAuthenticate(ignored: Int): Int = statusToReturn companion object { /** The status the next canAuthenticate call reports; BiometricManager codes. */