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

```
public final class BeginGetPublicKeyCredentialOption extends BeginGetCredentialOption
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.credentials.provider.BeginGetCredentialOption](https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption) ||
|   | ↳ | [androidx.credentials.provider.BeginGetPublicKeyCredentialOption](https://developer.android.com/reference/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/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/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/androidx/credentials/provider/BeginGetPublicKeyCredentialOption#BeginGetPublicKeyCredentialOption(android.os.Bundle,kotlin.String,kotlin.String,kotlin.ByteArray)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html candidateQueryData, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestJson, byte[] clientDataHash )` constructs an instance of `https://developer.android.com/reference/androidx/credentials/provider/BeginGetPublicKeyCredentialOption` |

| ### Public methods |
|---|---|
| `final byte[]` | `https://developer.android.com/reference/androidx/credentials/provider/BeginGetPublicKeyCredentialOption#getClientDataHash()()` 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 |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/provider/BeginGetPublicKeyCredentialOption#getRequestJson()()` the request in JSON format in the standard webauthn web json shown [here](https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson) |

### Inherited methods

From [androidx.credentials.provider.BeginGetCredentialOption](https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption) `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption#getCandidateQueryData()()`

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
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption#getId()()`

unique id representing this particular option, to be used while constructing the `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry` to be set on `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialResponse`
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption#getType()()`

the type of the credential to be retrieved against this option, e.g. a `https://developer.android.com/reference/androidx/credentials/provider/BeginGetPasswordOption` will have type `https://developer.android.com/reference/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)

```
public BeginGetPublicKeyCredentialOption(
    @NonNull Bundle candidateQueryData,
    @NonNull String id,
    @NonNull String requestJson,
    byte[] clientDataHash
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html candidateQueryData` | the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | the id of this request option |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestJson` | the request in JSON format in the standard webauthn web json shown [here](https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson) |
| `byte[] 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 |

## Public methods

### getClientDataHash

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

```
public final byte[] getClientDataHash()
```

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

### getRequestJson

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

```
public final @NonNull String getRequestJson()
```

the request in JSON format in the standard webauthn web json shown [here](https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson)