Skip to content

Commit c137a07

Browse files
committed
Use the Jetpack API for issuance response
1 parent 5195165 commit c137a07

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

app/src/main/java/com/credman/cmwallet/createcred/CreateCredentialViewModel.kt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package com.credman.cmwallet.createcred
22

33
import android.net.Uri
4-
import android.os.Bundle
54
import android.util.Base64
65
import android.util.Log
76
import androidx.compose.runtime.getValue
87
import androidx.compose.runtime.mutableStateOf
98
import androidx.compose.runtime.setValue
109
import androidx.credentials.CreateCredentialResponse
11-
import androidx.credentials.CreateCustomCredentialResponse
12-
import androidx.credentials.DigitalCredential
10+
import androidx.credentials.CreateDigitalCredentialResponse
1311
import androidx.credentials.ExperimentalDigitalCredentialApi
1412
import androidx.credentials.provider.ProviderCreateCredentialRequest
1513
import androidx.lifecycle.ViewModel
@@ -409,16 +407,13 @@ class CreateCredentialViewModel : ViewModel() {
409407
}
410408

411409
private fun onResponse(newEntryId: String) {
412-
val testResponse = CreateCustomCredentialResponse(
413-
type = DigitalCredential.TYPE_DIGITAL_CREDENTIAL,
414-
data = Bundle().apply {
415-
putString(
416-
"androidx.credentials.BUNDLE_KEY_RESPONSE_JSON",
417-
JSONObject().put("protocol", "openid4vci").put("data", JSONObject()).toString()
418-
)
419-
},
410+
val ackResponse = CreateDigitalCredentialResponse(
411+
JSONObject()
412+
.put("protocol", "openid4vci")
413+
.put("data", JSONObject())
414+
.toString()
420415
)
421-
uiState = uiState.copy(state = Result.Response(testResponse, newEntryId))
416+
uiState = uiState.copy(state = Result.Response(ackResponse, newEntryId))
422417
}
423418

424419
private fun onError(msg: String? = null) {

0 commit comments

Comments
 (0)