GetPublicKeyCredentialOption


public final class GetPublicKeyCredentialOption extends CredentialOption


A request to get passkeys from the user's public key credential provider.

Summary

Public constructors

GetPublicKeyCredentialOption(
    @NonNull String requestJson,
    byte[] clientDataHash,
    @NonNull Set<@NonNull ComponentName> allowedProviders
)

Constructs a GetPublicKeyCredentialOption.

Public methods

final byte[]

a clientDataHash value to sign over in place of assembling and hashing clientDataJSON during the signature request; meaningful only if you have set the GetCredentialRequest.origin

final @NonNull String

the request in JSON format in the standard webauthn web json shown here.

Inherited methods

From androidx.credentials.CredentialOption
final @NonNull Set<@NonNull ComponentName>

a set of provider service ComponentName allowed to receive this option (Note: a SecurityException will be thrown if it is set as non-empty but your app does not have android.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS; for API level < 34, this property will not take effect and you should control the allowed provider via library dependencies)

final @NonNull Bundle

the partial request data in the Bundle format that will be sent to the provider during the initial candidate query stage, which will not contain sensitive user information

final @NonNull Bundle

the request data in the Bundle format

final @NonNull String

the credential type determined by the credential-type-specific subclass (e.g. the type for GetPasswordOption is PasswordCredential.TYPE_PASSWORD_CREDENTIAL and for GetPublicKeyCredentialOption is PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL)

final @PriorityHints int

sets the priority of this entry, which defines how it appears in the credential selector, with less precedence than account ordering but more precedence than last used time; see PriorityHints for more information

final boolean

whether a credential entry will be automatically chosen if it is the only one available option

final boolean

true if must only be fulfilled by a system provider and false otherwise

Public constructors

GetPublicKeyCredentialOption

Added in 1.2.0
public GetPublicKeyCredentialOption(
    @NonNull String requestJson,
    byte[] clientDataHash,
    @NonNull Set<@NonNull ComponentName> allowedProviders
)

Constructs a GetPublicKeyCredentialOption.

Parameters
@NonNull String requestJson

the request in JSON format in the standard webauthn web json shown here.

byte[] clientDataHash

a clientDataHash value to sign over in place of assembling and hashing clientDataJSON during the signature request; set only if you have set the GetCredentialRequest.origin

@NonNull Set<@NonNull ComponentName> allowedProviders

a set of provider service ComponentName allowed to receive this option (Note: a SecurityException will be thrown if it is set as non-empty but your app does not have android.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS; for API level < 34, this property will not take effect and you should control the allowed provider via library dependencies)

Throws
kotlin.NullPointerException

If requestJson is null

kotlin.IllegalArgumentException

If requestJson is empty, or if it is not a valid JSON

Public methods

getClientDataHash

Added in 1.2.0
public final byte[] getClientDataHash()

a clientDataHash value to sign over in place of assembling and hashing clientDataJSON during the signature request; meaningful only if you have set the GetCredentialRequest.origin

getRequestJson

Added in 1.2.0
public final @NonNull String getRequestJson()

the request in JSON format in the standard webauthn web json shown here.