# BeginCreatePublicKeyCredentialRequest

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

*** ** * ** ***

<br />

```
class BeginCreatePublicKeyCredentialRequest : BeginCreateCredentialRequest
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.credentials.provider.BeginCreateCredentialRequest](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialRequest) ||
|   | ↳ | [androidx.credentials.provider.BeginCreatePublicKeyCredentialRequest](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest) |

*** ** * ** ***

Request to begin registering a public key credential.

This request will not contain all parameters needed to create the public key. Provider must use the initial parameters to determine if the public key can be created, and return a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialResponse` containing a list of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry`, denoting the accounts/groups where the public key can be registered. When user selects one of the returned `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry`, the corresponding `https://developer.android.com/reference/android/app/PendingIntent.html` set on the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` will be fired. The `https://developer.android.com/reference/android/content/Intent.html` invoked through the `https://developer.android.com/reference/android/app/PendingIntent.html` will contain the complete `https://developer.android.com/reference/kotlin/androidx/credentials/CreatePublicKeyCredentialRequest`. This request will contain all required parameters to actually register a public key.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#requestJson()` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#(kotlin.String,androidx.credentials.provider.CallingAppInfo,android.os.Bundle,kotlin.ByteArray)` is null |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#requestJson()` is empty, or is not a valid JSON |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialRequest` | Note: Credential providers are not expected to utilize the constructor in this class for any production flow. This constructor must only be used for testing purposes. |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#BeginCreatePublicKeyCredentialRequest(kotlin.String,androidx.credentials.provider.CallingAppInfo,android.os.Bundle,kotlin.ByteArray)( requestJson: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, callingAppInfo: https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo?, candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html, clientDataHash: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html? )` constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#clientDataHash()` a hash that is used to verify the relying party identity, set only if `https://developer.android.com/reference/android/service/credentials/CallingAppInfo.html#getOrigin()` is set |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#requestJson()` the request json to be used for registering the public key credential |

### Inherited properties

From [androidx.credentials.provider.BeginCreateCredentialRequest](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialRequest) `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo?` `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialRequest#callingAppInfo()` `https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialRequest#candidateQueryData()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialRequest#type()`

## Public constructors

### BeginCreatePublicKeyCredentialRequest

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

```
BeginCreatePublicKeyCredentialRequest(
    requestJson: String,
    callingAppInfo: CallingAppInfo?,
    candidateQueryData: Bundle,
    clientDataHash: ByteArray? = null
)
```

constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest`

| Parameters |
|---|---|
| `requestJson: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the request json to be used for registering the public key credential |
| `callingAppInfo: https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo?` | the information pertaining to the app requesting for credentials |
| `candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html` | the raw bundle containing the request parameters, not expected to be used directly as all basic parameters are parsed into structured properties in this class like `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#requestJson()` and `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest#clientDataHash()` |
| `clientDataHash: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html? = null` | a hash that is used to verify the relying party identity, set only if `https://developer.android.com/reference/android/service/credentials/CallingAppInfo.html#getOrigin()` is set |

## Public properties

### clientDataHash

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

```
val clientDataHash: ByteArray?
```

a hash that is used to verify the relying party identity, set only if `https://developer.android.com/reference/android/service/credentials/CallingAppInfo.html#getOrigin()` is set

### requestJson

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

```
val requestJson: String
```

the request json to be used for registering the public key credential