# BiometricPromptData

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/provider/BiometricPromptData.kt+class:androidx.credentials.provider.BiometricPromptData) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

*** ** * ** ***

<br />

```
class BiometricPromptData
```

<br />

*** ** * ** ***

Biometric prompt data that can be optionally used to provide information needed for the system to show a biometric prompt directly embedded into the Credential Manager selector.

If you opt to use this, the meta-data provided through the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry` will be shown along with a biometric / device credential capture mechanism, on a single dialog, hence avoiding navigation through multiple screens. When user confirmation is retrieved through the aforementioned biometric / device capture mechanism, the `https://developer.android.com/reference/android/app/PendingIntent.html` associated with the entry is invoked, and the flow continues as explained in `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry`.

Note that the value of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` together with the features of a given device, determines whether a biometric auth or a device credential mechanism will / can be shown. The value for this property is found in `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators`.

Finally, note that the CryptoObject does not presently support presentationSession and operationHandle constructors, and intends to support the CryptoObject built from the stable biometric jetpack library described [here](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0).

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#cryptoObject()` is not null, and the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` is not set to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators` |   |

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder` Builder for constructing an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#BiometricPromptData(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)( cryptoObject: https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject?, allowedAuthenticators: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Biometric prompt data that can be optionally used to provide information needed for the system to show a biometric prompt directly embedded into the Credential Manager selector. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` specifies the type(s) of authenticators that may be invoked by the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` to authenticate the user, defaults to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()` if not set |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#cryptoObject()` a crypto object to be unlocked after successful authentication; When set, the value of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` must be `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` or else an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, note that the CryptoObject does not presently support presentationSession and operationHandle constructors, and intends to support the CryptoObject built from the stable biometric jetpack library described [here](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0) |

## Public constructors

### BiometricPromptData

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
BiometricPromptData(
    cryptoObject: BiometricPrompt.CryptoObject? = null,
    allowedAuthenticators: Int = BIOMETRIC_WEAK
)
```

Biometric prompt data that can be optionally used to provide information needed for the system to show a biometric prompt directly embedded into the Credential Manager selector.

If you opt to use this, the meta-data provided through the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry` will be shown along with a biometric / device credential capture mechanism, on a single dialog, hence avoiding navigation through multiple screens. When user confirmation is retrieved through the aforementioned biometric / device capture mechanism, the `https://developer.android.com/reference/android/app/PendingIntent.html` associated with the entry is invoked, and the flow continues as explained in `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry`.

Note that the value of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` together with the features of a given device, determines whether a biometric auth or a device credential mechanism will / can be shown. The value for this property is found in `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators`.

Finally, note that the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject` does not presently support presentationSession and operationHandle constructors, and intends to support the CryptoObject built from the stable biometric jetpack library described [here](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0).

| Parameters |
|---|---|
| `cryptoObject: https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject? = null` | a crypto object to be unlocked after successful authentication; When set, the value of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` must be `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` or else an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, note that the CryptoObject does not presently support presentationSession and operationHandle constructors, and intends to support the CryptoObject built from the stable biometric jetpack library described [here](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0) |
| `allowedAuthenticators: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = BIOMETRIC_WEAK` | specifies the type(s) of authenticators that may be invoked by the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` to authenticate the user, defaults to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()` if not set |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` is not null, and the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` is not set to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators` |   |

## Public properties

### allowedAuthenticators

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
val allowedAuthenticators: Int
```

specifies the type(s) of authenticators that may be invoked by the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` to authenticate the user, defaults to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()` if not set

### cryptoObject

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
val cryptoObject: BiometricPrompt.CryptoObject?
```

a crypto object to be unlocked after successful authentication; When set, the value of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` must be `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` or else an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, note that the CryptoObject does not presently support presentationSession and operationHandle constructors, and intends to support the CryptoObject built from the stable biometric jetpack library described [here](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0)