# BeginGetPublicKeyCredentialOption

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

*** ** * ** ***

<br />

```
class BeginGetPublicKeyCredentialOption : BeginGetCredentialOption
```

<br />

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

*** ** * ** ***

A request to begin the flow of getting passkeys from the user's public key credential provider.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetPublicKeyCredentialOption#requestJson()` 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/BeginGetPublicKeyCredentialOption#requestJson()` is empty, or is not a valid JSON 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/BeginGetPublicKeyCredentialOption#BeginGetPublicKeyCredentialOption(android.os.Bundle,kotlin.String,kotlin.String,kotlin.ByteArray)( candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, requestJson: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.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/BeginGetPublicKeyCredentialOption` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetPublicKeyCredentialOption#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/BeginGetPublicKeyCredentialOption#requestJson()` the request in JSON format in the standard webauthn web json shown [here](https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson) |

### Inherited properties

From [androidx.credentials.provider.BeginGetCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialOption) `https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialOption#candidateQueryData()`

the parameters needed to retrieve the credentials, in the form of the raw `https://developer.android.com/reference/android/os/Bundle.html` - can typically be ignored by the credential provider as the required properties are already parse into the structured subclasses
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialOption#id()`

unique id representing this particular option, to be used while constructing the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry` to be set on `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialResponse`
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialOption#type()`

the type of the credential to be retrieved against this option, e.g. a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetPasswordOption` will have type `https://developer.android.com/reference/kotlin/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()`

## Public constructors

### BeginGetPublicKeyCredentialOption

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

```
BeginGetPublicKeyCredentialOption(
    candidateQueryData: Bundle,
    id: String,
    requestJson: String,
    clientDataHash: ByteArray? = null
)
```

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

| Parameters |
|---|---|
| `candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html` | the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the id of this request option |
| `requestJson: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the request in JSON format in the standard webauthn web json shown [here](https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson) |
| `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 in JSON format in the standard webauthn web json shown [here](https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson)