diff --git a/example/build.gradle.kts b/example/build.gradle.kts index 6b5c4e8..635f710 100644 --- a/example/build.gradle.kts +++ b/example/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "com.spruceid.mobilesdkexample" minSdk = 26 targetSdk = 34 - versionCode = 20 - versionName = "1.3.0" + versionCode = 22 + versionName = "1.3.2" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/example/src/main/java/com/spruceid/mobilesdkexample/wallet/HandleOID4VPView.kt b/example/src/main/java/com/spruceid/mobilesdkexample/wallet/HandleOID4VPView.kt index 16ae721..b69dd1f 100644 --- a/example/src/main/java/com/spruceid/mobilesdkexample/wallet/HandleOID4VPView.kt +++ b/example/src/main/java/com/spruceid/mobilesdkexample/wallet/HandleOID4VPView.kt @@ -76,11 +76,16 @@ import kotlinx.coroutines.withContext import org.json.JSONObject class Signer(keyId: String?) : PresentationSigner { - private val keyId = if (keyId == null) "reference-app/default-signing" else keyId + private val keyId = keyId ?: "reference-app/default-signing" private val keyManager = KeyManager() - private val jwk = keyManager.getJwk(this.keyId) ?: throw IllegalArgumentException("Invalid kid") + private var jwk: String private val didJwk = DidMethodUtils(DidMethod.JWK) + init { + keyManager.generateSigningKey(id = this.keyId) + this.jwk = keyManager.getJwk(this.keyId) ?: throw IllegalArgumentException("Invalid kid") + } + override suspend fun sign(payload: ByteArray): ByteArray { val signature = keyManager.signPayload(keyId, payload) @@ -151,7 +156,18 @@ fun HandleOID4VPView( getVCPlaygroundOID4VCIContext(ctx) ) val newurl = url.replace("authorize", "") - permissionRequest = holder!!.authorizationRequest(newurl) + val tempPermissionRequest = holder!!.authorizationRequest(newurl) + val permissionRequestCredentials = tempPermissionRequest.credentials() + + if (permissionRequestCredentials.count() == 1) { + selectedCredential = permissionRequestCredentials.first() + permissionResponse = + tempPermissionRequest.createPermissionResponse( + permissionRequestCredentials + ) + } + + permissionRequest = tempPermissionRequest } } catch (e: Exception) { err = e.localizedMessage