UserKeyDialog
A Jetpack Compose dialog for selecting a user key from multiple registered device bindings.
This composable displays a Material Design 3 modal dialog that allows users to select one of their registered device binding keys when multiple keys exist. The dialog includes:
A title indicating the purpose of the selection
An exposed dropdown menu showing all available user keys
Cancel and Confirm action buttons
Full Material Theme integration
UI Components
Title
Displayed as "Select User Key" in headlineSmall typography
Provides context for the selection action
User Key Dropdown (ExposedDropdownMenuBox)
Display Format: Shows user keys as "{username} ({authenticationType})"
Example: "john.doe@example.com (BIOMETRIC_ONLY)"
Example: "alice@example.com (APPLICATION_PIN)"
Behavior:
Read-only text field that opens a dropdown menu on click
Menu displays all available user keys
Selected key is displayed in the text field
Styling: Outlined text field with Material 3 theming
Action Buttons
Cancel: TextButton that dismisses the dialog without selecting a key
Confirm: Primary Button that submits the selected user key
Disabled when no key is selected
Enabled only after a user selects a key from the dropdown
Dialog Behavior
Dismissal: Can be dismissed by pressing the back button (triggers cancellation callback)
Click Outside: Clicking outside the dialog does NOT dismiss it (dismissOnClickOutside = false)
Confirmation: Clicking Confirm only works when a user key is selected
Selection State: Maintains the selected key until user confirms or cancels
Use Cases
Multiple Users on Shared Device
When multiple users have registered their credentials on a shared device:
User Keys:
- alice@example.com (BIOMETRIC_ONLY)
- bob@example.com (APPLICATION_PIN)
- charlie@example.com (BIOMETRIC_OR_DEVICE_CREDENTIAL)Parameters
The list of available UserKeyOption objects to display for selection. Each option represents a registered device binding with associated metadata. The dropdown will show all options with their username and authentication type.
Callback invoked when the user confirms their selection. Receives the selected UserKeyOption object. The caller should use this to proceed with authentication using the selected key.
Callback invoked when the user cancels the selection by pressing Cancel, back button, or dismissing the dialog. No user key is provided.