DigitalCredential


@ExperimentalDigitalCredentialApi
class DigitalCredential : Credential


Represents the user's digital credential, generally used for verification or sign-in purposes.

Notice, this class does not necessarily always represents a successful digital credential. Depending on the protocol in your request, the credentialJson may contain a failure response generated from the provider. Therefore, please follow the protocol specification to parse the credentialJson and determine the failure / success response. For example, here is the error response definition for the OpenID for Verifiable Presentations protocol.

When you make an OpenID4VP request for multiple credentials, you may receive a GetCredentialResponse containing a list of DigitalCredential. These credentials may be aggregated from one or more providers. Because some responses may contain an OpenID4VP error, you should check each individual DigitalCredential to ensure it satisfies your overall request.

NOTE: For non-protocol errors (system-level infrastructure failures, provider crashes, or generic CredMan exceptions), the transaction will NOT return any partial credentials at all. Such failures trigger an immediate transaction abort where zero credentials are yielded.

Summary

Constants

const String

The type value for public key credential related operations.

Public constructors

DigitalCredential(credentialJson: String)

Constructs a DigitalCredential.

Public properties

String

the digital credential in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredential-interface

Inherited properties

From androidx.credentials.Credential
Bundle

the credential data in the Bundle format

String

the credential type determined by the credential-type-specific subclass (e.g. PasswordCredential.TYPE_PASSWORD_CREDENTIAL for PasswordCredential or PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL for PublicKeyCredential)

Constants

TYPE_DIGITAL_CREDENTIAL

const val TYPE_DIGITAL_CREDENTIALString

The type value for public key credential related operations.

Public constructors

DigitalCredential

Added in 1.5.0
DigitalCredential(credentialJson: String)

Constructs a DigitalCredential.

Parameters
credentialJson: String

the digital credential in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredential-interface

Throws
IllegalArgumentException

if the credentialJson is not a valid json

Public properties

credentialJson

Added in 1.5.0
val credentialJsonString

the digital credential in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredential-interface