createCredentialRequest

suspend fun createCredentialRequest(credential: SupportedCredentialFormat, requestedAttributes: Set<String>? = null, clientNonce: String?, credentialIssuer: String?): KmmResult<CredentialRequestParameters>(source)

Send the result as JSON-serialized content to the server at /credential (or more specific IssuerMetadata.credentialEndpointUrl).

Also send along the TokenResponseParameters.accessToken from the token response in HTTP header Authorization as value Bearer accessTokenValue (depending on the TokenResponseParameters.tokenType). See createTokenRequestParameters.

Sample ktor code:

val credentialRequest = client.createCredentialRequestJwt(
requestOptions = requestOptions,
clientNonce = token.clientNonce,
credentialIssuer = issuerMetadata.credentialIssuer
).getOrThrow()

val credentialResponse = httpClient.post(issuerMetadata.credentialEndpointUrl) {
setBody(credentialRequest)
headers {
append(HttpHeaders.Authorization, "Bearer ${token.accessToken}")
}
}

Parameters

credential

which credential from IssuerMetadata.supportedCredentialConfigurations to request

requestedAttributes

attributes that shall be requested explicitly (selective disclosure)

clientNonce

c_nonce from the token response, optional string, see TokenResponseParameters.clientNonce

credentialIssuer

credential_issuer from the metadata, see IssuerMetadata.credentialIssuer


suspend fun createCredentialRequest(requestOptions: WalletService.RequestOptions, clientNonce: String?, credentialIssuer: String?): KmmResult<CredentialRequestParameters>(source)

Send the result as JSON-serialized content to the server at /credential (or more specific IssuerMetadata.credentialEndpointUrl).

Also send along the TokenResponseParameters.accessToken from the token response in HTTP header Authorization as value Bearer accessTokenValue (depending on the TokenResponseParameters.tokenType). See createTokenRequestParameters.

Sample ktor code:

val credentialRequest = client.createCredentialRequestJwt(
requestOptions = requestOptions,
clientNonce = token.clientNonce,
credentialIssuer = issuerMetadata.credentialIssuer
).getOrThrow()

val credentialResponse = httpClient.post(issuerMetadata.credentialEndpointUrl) {
setBody(credentialRequest)
headers {
append(HttpHeaders.Authorization, "Bearer ${token.accessToken}")
}
}

Parameters

requestOptions

which credential in which representation to request

clientNonce

c_nonce from the token response, optional string, see TokenResponseParameters.clientNonce

credentialIssuer

credential_issuer from the metadata, see IssuerMetadata.credentialIssuer