prepareCredentialRequests

fun prepareCredentialRequests(tokenResponse: TokenResponseParameters, metadata: IssuerMetadata, credentialFormats: Collection<SupportedCredentialFormat>, previouslyRequestedScope: String? = null): KmmResult<Collection<OpenId4VciClient.PreparedCredentialRequest>>(source)

Prepares the credential requests the access token of tokenResponse grants for the credentials of credentialFormats, each with the configuration its proof and response depend on, still without proofs and encryption. Create each request with its own c_nonce right before sending it with OpenId4VciProtocolClient.credentialRequest, which adds the access token from tokenResponse and, for DPoP-bound tokens, the DPoP proof, and parses the response.

Fails if the token grants none of credentialFormats.

Parameters

tokenResponse

from the authorization server token endpoint

metadata

the issuer's metadata, see IssuerMetadata

credentialFormats

which credentials to request, picked out of IssuerMetadata.supportedCredentialConfigurations

previouslyRequestedScope

the scope value requested in the token request, since the authorization server may not set it in tokenResponse


fun prepareCredentialRequests(tokenResponse: TokenResponseParameters, metadata: IssuerMetadata, previouslyRequestedScope: String? = null): KmmResult<Collection<OpenId4VciClient.PreparedCredentialRequest>>(source)

Prepares the credential requests the access token of tokenResponse grants for all its credentials, each with the configuration its proof and response depend on, still without proofs and encryption. Create each request with its own c_nonce right before sending it with OpenId4VciProtocolClient.credentialRequest, which adds the access token from tokenResponse and, for DPoP-bound tokens, the DPoP proof, and parses the response.

Parameters

tokenResponse

from the authorization server token endpoint

metadata

the issuer's metadata, see IssuerMetadata

previouslyRequestedScope

the scope value requested in the token request, since the authorization server may not set it in tokenResponse


Prepares one credential request per entry of credentialConfigurationIds, each with its configuration from IssuerMetadata.supportedCredentialConfigurations of metadata, still without proofs and encryption, see createCredential.

Only use this when the token response contained no credential_identifiers in its authorization_details, because then the requests have to use those, and credential_configuration_id "MUST NOT be present" (OpenID4VCI 1.0, 8.2). Otherwise, use the overload accepting TokenResponseParameters.

Fails for an identifier that metadata does not list.

Parameters

credentialConfigurationIds

the exact credential_configuration_ids to request, keys of IssuerMetadata.supportedCredentialConfigurations

metadata

the issuer's metadata, see IssuerMetadata