GetPublicKeyCredentialOption


class GetPublicKeyCredentialOption : CredentialOption


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

Summary

Public constructors

GetPublicKeyCredentialOption(
    requestJson: String,
    clientDataHash: ByteArray?,
    allowedProviders: Set<ComponentName>
)

Constructs a GetPublicKeyCredentialOption.

Public properties

ByteArray?

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

String

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

Inherited properties

From androidx.credentials.CredentialOption
Set<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)

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

Boolean

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

Boolean

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

Bundle

the request data in the Bundle format

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)

@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

Public constructors

GetPublicKeyCredentialOption

Added in 1.2.0
GetPublicKeyCredentialOption(
    requestJson: String,
    clientDataHash: ByteArray? = null,
    allowedProviders: Set<ComponentName> = emptySet()
)

Constructs a GetPublicKeyCredentialOption.

Parameters
requestJson: String

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

clientDataHash: ByteArray? = null

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

allowedProviders: Set<ComponentName> = emptySet()

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 properties

clientDataHash

Added in 1.2.0
val clientDataHashByteArray?

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

requestJson

Added in 1.2.0
val requestJsonString

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