# BiometricPromptData.Builder

# BiometricPromptData.Builder

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.Builder)  
Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder "View this page in Java")

<br />

```
class BiometricPromptData.Builder
```

<br />

*** ** * ** ***

Builder for constructing an instance of[BiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData)

## Summary

|                                                      ### Public constructors                                                      |
|-----------------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder#Builder())`()` |

|                                                          ### Public functions                                                           |
|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData)                 | [build](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder#build())`()` Builds the[BiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData)instance.                                                                                                                                                                                                                                                                                 |
| [BiometricPromptData.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder) | [setAllowedAuthenticators](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder#setAllowedAuthenticators(kotlin.Int))`(allowedAuthenticators: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Specifies the type(s) of authenticators that may be invoked to authenticate the user.                                                                                                                                                                                  |
| [BiometricPromptData.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder) | [setCryptoObject](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder#setCryptoObject(androidx.biometric.BiometricPrompt.CryptoObject))`(cryptoObject: `[BiometricPrompt.CryptoObject](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject)`?)` Sets whether this[BiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData)should have a crypto object associated with this authentication. |

## Public constructors

### Builder

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

```
Builder()
```  

## Public functions

### build

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

```
fun build(): BiometricPromptData
```

Builds the[BiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData)instance.  

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

### setAllowedAuthenticators

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

```
fun setAllowedAuthenticators(allowedAuthenticators: Int): BiometricPromptData.Builder
```

Specifies the type(s) of authenticators that may be invoked to authenticate the user. Available authenticator types are defined in[Authenticators](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators)and can be combined via bitwise OR. Defaults to[BIOMETRIC_WEAK](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()).

If this method is used and no authenticator of any of the specified types is available at the time an error code will be supplied as part of[android.content.Intent](https://developer.android.com/reference/android/content/Intent.html)that will be launched by the containing[CredentialEntry](https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry)or[CreateEntry](https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry)'s corresponding[android.app.PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html).  

|                                              Parameters                                              |
|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| `allowedAuthenticators: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | A bit field representing all valid authenticator types that may be invoked by the Credential Manager selector. |

### setCryptoObject

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

```
fun setCryptoObject(cryptoObject: BiometricPrompt.CryptoObject?): BiometricPromptData.Builder
```

Sets whether this[BiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData)should have a crypto object associated with this authentication. If opting to pass in a value, the[allowedAuthenticators](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData.Builder#allowedAuthenticators())must be[BIOMETRIC_STRONG](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()). 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).  

|                                                                    Parameters                                                                     |
|---------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cryptoObject: `[BiometricPrompt.CryptoObject](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject)`?` | the[CryptoObject](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject)to be associated with this biometric authentication flow |