mirror of
https://github.com/bitwarden/android.git
synced 2025-12-05 18:46:49 -06:00
Credential Manager Test Harness
Purpose
This standalone application serves as a test client for validating the Bitwarden Android credential provider implementation. It uses the Android CredentialManager APIs to request credential operations and verify that the :app module responds correctly as a credential provider.
Future iterations will introduce validation for the Android Autofill Framework.
Features
- Password Creation: Test
CreatePasswordRequestflow through CredentialManager - Password Retrieval: Test
GetPasswordOptionflow through CredentialManager - Passkey Creation: Test
CreatePublicKeyCredentialRequestflow through CredentialManager
Requirements
- Android device or emulator running API 28+
- Bitwarden app (
:app) installed and configured as a credential provider - Google Play Services (for API 28-33 compatibility)
Usage
Setup
- Build and install the main Bitwarden app (
:app) - Configure Bitwarden as a credential provider in system settings:
- Settings → Passwords & accounts → Credential Manager
- Enable Bitwarden as a provider
- Build and install the test harness:
./gradlew :testharness:installDebug
Running Tests
- Launch "Credential Manager Test Harness" app
- Select a credential operation type (Password Create, Password Get, or Passkey Create)
- Fill in required fields:
- Password Create: Username, Password, Origin (optional)
- Password Get: No inputs required
- Passkey Create: Username, Relying Party ID, Origin
- Passkey Get: Relying Party ID, Origin
- Tap "Execute" button
- System credential picker should appear with Bitwarden as an option
- Select Bitwarden and follow the flow
- Result will be displayed in the app
Known Limitations
- API 28-33 compatibility: Requires Google Play Services for CredentialManager APIs on older Android versions.
- Passkey operations must be performed as a Privileged App due to security measures built in
:app.
Architecture
This module follows the same architectural patterns as the main Bitwarden app:
- MVVM + UDF:
BaseViewModelwith State/Action/Event pattern - Hilt DI: Dependency injection throughout
- Compose UI: Modern declarative UI with Material 3
- Result handling: No exceptions, sealed result classes
Testing
Run unit tests:
./gradlew :testharness:test
Debugging
Check Logcat for detailed error messages:
adb logcat | grep -E "CredentialManager|Bitwarden|TestHarness"