diff --git a/android/src/main/java/com/oblador/keychain/KeychainModule.kt b/android/src/main/java/com/oblador/keychain/KeychainModule.kt index 722a5ed9..be575c84 100644 --- a/android/src/main/java/com/oblador/keychain/KeychainModule.kt +++ b/android/src/main/java/com/oblador/keychain/KeychainModule.kt @@ -68,6 +68,7 @@ class KeychainModule(reactContext: ReactApplicationContext) : const val SUBTITLE = "subtitle" const val DESCRIPTION = "description" const val CANCEL = "cancel" + const val CONFIRMATION_REQUIRED = "confirmationRequired" } } @@ -779,9 +780,14 @@ class KeychainModule(reactContext: ReactApplicationContext) : promptInfoBuilder.setNegativeButtonText(it) } } - - /* Bypass confirmation to avoid KeyStore unlock timeout being exceeded when using passive biometrics */ - promptInfoBuilder.setConfirmationRequired(false) + // Default is false — no confirmation required unless explicitly set + var confirmationRequired = false + promptInfoOptionsMap?.let { + if (it.hasKey(AuthPromptOptions.CONFIRMATION_REQUIRED)) { + confirmationRequired = it.getBoolean(AuthPromptOptions.CONFIRMATION_REQUIRED) + } + } + promptInfoBuilder.setConfirmationRequired(confirmationRequired) return promptInfoBuilder.build() } diff --git a/src/types.ts b/src/types.ts index 00448d3a..dbcc4264 100644 --- a/src/types.ts +++ b/src/types.ts @@ -24,6 +24,12 @@ export type AuthenticationPrompt = { * @platform Android */ cancel?: string; + + /** Whether user confirmation (e.g. OK button) is required after authentication. + * Default is `false`. + * @platform Android + */ + confirmationRequired?: boolean; }; export type BaseOptions = {