Issuance

Receives one offer's credentials: show offer; then beginAuthorization, open the URL in an Auth Tab or Custom Tab and completeAuthorization, or redeemPreAuthorizedCode; then requestCredentials; close when done. An issuance dropped without close leaves its keys until Wallet.sweepOrphanedKeys.

Types

Link copied to clipboard
@Serializable
data class FailedCredential(val configurationID: String, val rawCode: String, val protocolError: String? = null)

An offered credential that couldn't be obtained: its error's code and, when the issuer gave one, its OAuth error code.

Link copied to clipboard
@Serializable
data class Result(val credentials: List<CredentialSummary>, val deferred: List<DeferredCredential>, val failed: List<Issuance.FailedCredential> = emptyList())

Properties

Link copied to clipboard

What's offered: show it before going on.

Functions

Link copied to clipboard
suspend fun beginAuthorization(): String

Begins the authorization code grant, returning the issuer's authorization URL to open in an Auth Tab or Custom Tab. Calling it again begins again: after the holder closed the page, say.

Link copied to clipboard
suspend fun close()

Ends the issuance, deleting its keys but those its deferred credentials still poll with.

Link copied to clipboard
suspend fun completeAuthorization(redirect: String)

Completes the authorization with the issuer's redirect back. The redirect is used up whatever happens: if this fails — the token request didn't get through, say — call beginAuthorization again, rather than retrying this.

Link copied to clipboard
suspend fun redeemPreAuthorizedCode(pin: String = "")

Redeems a pre-authorized code offer, with the PIN the holder typed when Offer.txCode asks for one. A wrong PIN throws a retryable protocol error (invalid_grant): ask again.

Link copied to clipboard

Requests, checks and stores every offered credential.