Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Injimob 2265] update vp response to return state #15

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class OpenID4VP(private val traceabilityId: String) {
return AuthorizationResponse.shareVP(
vpResponseMetadata,
authorizationRequest.nonce,
authorizationRequest.state,
authorizationRequest.responseUri,
(this.authorizationRequest.presentationDefinition as PresentationDefinition).id
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ class AuthorizationResponse {
}
}

fun shareVP(vpResponseMetadata: VPResponseMetadata, nonce: String, responseUri: String, presentationDefinitionId: String): String {
fun shareVP(
vpResponseMetadata: VPResponseMetadata,
nonce: String,
state: String,
responseUri: String,
presentationDefinitionId: String
): String {
try {
vpResponseMetadata.validate()
var pathIndex = 0
Expand All @@ -71,7 +77,7 @@ class AuthorizationResponse {
return constructHttpRequestBody(
vpToken,
presentationSubmission,
responseUri,
responseUri, state
)
} catch (exception: Exception) {
Logger.error(logTag, exception)
Expand All @@ -82,7 +88,7 @@ class AuthorizationResponse {
private fun constructHttpRequestBody(
vpToken: VPToken,
presentationSubmission: PresentationSubmission,
responseUri: String,
responseUri: String, state: String
): String {
val encodedVPToken: String
val encodedPresentationSubmission: String
Expand All @@ -102,7 +108,8 @@ class AuthorizationResponse {
try {
val bodyParams = mapOf(
"vp_token" to encodedVPToken,
"presentation_submission" to encodedPresentationSubmission
"presentation_submission" to encodedPresentationSubmission,
"state" to state
)

return sendHttpPostRequest(responseUri, bodyParams)
Expand Down
Loading