# 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 />

```
public final 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/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/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/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry`.

Note that the value of `https://developer.android.com/reference/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/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/androidx/credentials/provider/BiometricPromptData#cryptoObject()` is not null, and the `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` is not set to `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` |

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

## Summary

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

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#BiometricPromptData(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)( https://developer.android.com/reference/androidx/biometric/BiometricPrompt.CryptoObject cryptoObject, int allowedAuthenticators )` 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 methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#getAllowedAuthenticators()()` specifies the type(s) of authenticators that may be invoked by the `https://developer.android.com/reference/androidx/biometric/BiometricPrompt` to authenticate the user, defaults to `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()` if not set |
| `final https://developer.android.com/reference/androidx/biometric/BiometricPrompt.CryptoObject` | `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#getCryptoObject()()` a crypto object to be unlocked after successful authentication; When set, the value of `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` must be `https://developer.android.com/reference/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)

```
public BiometricPromptData(
    BiometricPrompt.CryptoObject cryptoObject,
    int allowedAuthenticators
)
```

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/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/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/androidx/credentials/provider/CreateEntry` or `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry`.

Note that the value of `https://developer.android.com/reference/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/androidx/biometric/BiometricManager.Authenticators`.

Finally, note that the `https://developer.android.com/reference/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 |
|---|---|
| `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.CryptoObject cryptoObject` | a crypto object to be unlocked after successful authentication; When set, the value of `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` must be `https://developer.android.com/reference/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) |
| `int allowedAuthenticators` | specifies the type(s) of authenticators that may be invoked by the `https://developer.android.com/reference/androidx/biometric/BiometricPrompt` to authenticate the user, defaults to `https://developer.android.com/reference/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/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` is not null, and the `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#(androidx.biometric.BiometricPrompt.CryptoObject,kotlin.Int)` is not set to `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` |

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

## Public methods

### getAllowedAuthenticators

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

```
public final int getAllowedAuthenticators()
```

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

### getCryptoObject

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

```
public final BiometricPrompt.CryptoObject getCryptoObject()
```

a crypto object to be unlocked after successful authentication; When set, the value of `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData#allowedAuthenticators()` must be `https://developer.android.com/reference/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)