createAuthorizationSession

suspend fun createAuthorizationSession(credentialOffer: String, clientId: String): AuthorizationSession
  1. Parses the credentialOffer.

  2. Fetches the metadata of the OpenID4VCI issuer, specified in the offer.

  3. Validates the offer against the issuer's metadata, and builds the DiscoveredCredentialOffer object.

  4. Generates the authorization request and returns the AuthorizationSession.

The AuthorizationSession object contains the AuthorizationSession.authorizeUrl which can be used to start the credential issuance flow. Use this function in conjunction with retrieveCredentials. This function should only be used for Authorization Code Flow.

Return

An Authorization Session object containing the decoded offer and authorization URL.

Parameters

credentialOffer

URL-encoded credential offer. It is received from the issuer, e.g., using the QR code. Currently only offer by value is supported.

clientId

The identifier that is registered with the issuer as a trusted wallet application.

Throws

If the SDK is not initialized before calling this function. See: initialize.

If there was a network connection issue during any network call in this function.

If the credential offer discovery process fails for any reason, other than those listed above. For instance, if there was an unexpected response from the server when requesting the issuer's metadata.

If the offer can be used only with Authorization Code Flow, but the redirect URI was not specified during the SDK initialization.

If the credential offer discovery process fails for any reason, other than those listed above. For instance, if there was an unexpected response from the server when requesting the issuer's metadata.