diff --git a/wallet/src/main/java/com/android/identity_credential/wallet/NfcEngagementHandler.kt b/wallet/src/main/java/com/android/identity_credential/wallet/NfcEngagementHandler.kt index 28873988a..ad525bec5 100644 --- a/wallet/src/main/java/com/android/identity_credential/wallet/NfcEngagementHandler.kt +++ b/wallet/src/main/java/com/android/identity_credential/wallet/NfcEngagementHandler.kt @@ -27,7 +27,10 @@ import com.android.identity.android.mdoc.engagement.NfcEngagementHelper import com.android.identity.android.mdoc.transport.DataTransport import com.android.identity.android.mdoc.transport.DataTransportOptions import com.android.identity.internal.Util +<<<<<<< HEAD import com.android.identity.securearea.EcCurve +======= +>>>>>>> 406e896 (Presentation Activity (#459)) import com.android.identity.securearea.SecureArea import com.android.identity.util.Logger @@ -38,7 +41,11 @@ class NfcEngagementHandler : HostApduService() { private var engagementHelper: NfcEngagementHelper? = null +<<<<<<< HEAD private val eDeviceKeyCurve = EcCurve.P256 +======= + private val eDeviceKeyCurve = SecureArea.EC_CURVE_P256 +>>>>>>> 406e896 (Presentation Activity (#459)) private val eDeviceKeyPair by lazy { Util.createEphemeralKeyPair(eDeviceKeyCurve) } diff --git a/wallet/src/main/java/com/android/identity_credential/wallet/PresentationActivity.kt b/wallet/src/main/java/com/android/identity_credential/wallet/PresentationActivity.kt index b6b800283..b5cae870b 100644 --- a/wallet/src/main/java/com/android/identity_credential/wallet/PresentationActivity.kt +++ b/wallet/src/main/java/com/android/identity_credential/wallet/PresentationActivity.kt @@ -41,7 +41,10 @@ import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.MutableLiveData import com.android.identity.android.mdoc.deviceretrieval.DeviceRetrievalHelper import com.android.identity.android.mdoc.transport.DataTransport +<<<<<<< HEAD import com.android.identity.credential.AuthenticationKey +======= +>>>>>>> 406e896 (Presentation Activity (#459)) import com.android.identity.credential.Credential import com.android.identity.credential.NameSpacedData import com.android.identity.internal.Util @@ -54,8 +57,11 @@ import com.android.identity.mdoc.request.DeviceRequestParser import com.android.identity.mdoc.response.DeviceResponseGenerator import com.android.identity.mdoc.response.DocumentGenerator import com.android.identity.mdoc.util.MdocUtil +<<<<<<< HEAD import com.android.identity.securearea.Algorithm import com.android.identity.securearea.EcCurve +======= +>>>>>>> 406e896 (Presentation Activity (#459)) import com.android.identity.securearea.SecureArea import com.android.identity.util.Constants import com.android.identity.util.Logger @@ -70,15 +76,24 @@ import java.util.OptionalLong class PresentationActivity : ComponentActivity() { companion object { private const val TAG = "PresentationActivity" +<<<<<<< HEAD private var transport: DataTransport? private var handover: ByteArray? private var eDeviceKeyCurve: EcCurve? private var eDeviceKeyPair: KeyPair? private var deviceEngagement: ByteArray? +======= + private var mTransport: DataTransport? + private var mHandover: ByteArray? + private var mEDeviceKeyCurve: Int? = null + private var mEDeviceKeyPair: KeyPair? + private var mDeviceEngagement: ByteArray? +>>>>>>> 406e896 (Presentation Activity (#459)) private var state = MutableLiveData() init { state.value = State.NOT_CONNECTED +<<<<<<< HEAD transport = null handover = null eDeviceKeyCurve = null @@ -94,6 +109,22 @@ class PresentationActivity : ComponentActivity() { this.eDeviceKeyCurve = eDeviceKeyCurve this.eDeviceKeyPair = eDeviceKeyPair this.deviceEngagement = deviceEngagement +======= + mTransport = null + mHandover = null + mEDeviceKeyCurve = null + mEDeviceKeyPair = null + mDeviceEngagement = null + } + + fun startPresentation(context: Context, transport: DataTransport, handover: ByteArray, + eDeviceKeyCurve: Int, eDeviceKeyPair: KeyPair, deviceEngagement: ByteArray) { + mTransport = transport + mHandover = handover + mEDeviceKeyCurve = eDeviceKeyCurve + mEDeviceKeyPair = eDeviceKeyPair + mDeviceEngagement = deviceEngagement +>>>>>>> 406e896 (Presentation Activity (#459)) Logger.i(TAG, "engagement info set") val launchAppIntent = Intent(context, PresentationActivity::class.java) @@ -227,9 +258,15 @@ class PresentationActivity : ComponentActivity() { }, ContextCompat.getMainExecutor(applicationContext), +<<<<<<< HEAD eDeviceKeyPair!!, eDeviceKeyCurve!!) .useForwardEngagement(transport!!, deviceEngagement!!, handover!!) +======= + mEDeviceKeyPair!!, + mEDeviceKeyCurve!!) + .useForwardEngagement(mTransport!!, mDeviceEngagement!!, mHandover!!) +>>>>>>> 406e896 (Presentation Activity (#459)) .build() } @@ -245,8 +282,13 @@ class PresentationActivity : ComponentActivity() { } deviceRetrievalHelper?.disconnect() deviceRetrievalHelper = null +<<<<<<< HEAD transport = null handover = null +======= + mTransport = null + mHandover = null +>>>>>>> 406e896 (Presentation Activity (#459)) state.value = State.NOT_CONNECTED } @@ -293,7 +335,11 @@ class PresentationActivity : ComponentActivity() { val credentialConfiguration = credential.credentialConfiguration val now = Timestamp.now() +<<<<<<< HEAD val authKey: AuthenticationKey +======= + val authKey: Credential.AuthenticationKey +>>>>>>> 406e896 (Presentation Activity (#459)) try { authKey = credential.findAuthenticationKey(WalletApplication.AUTH_KEY_DOMAIN, now)!! } catch (e: Exception) { @@ -323,7 +369,11 @@ class PresentationActivity : ComponentActivity() { authKey.secureArea, authKey.alias, null, +<<<<<<< HEAD Algorithm.ES256 +======= + SecureArea.ALGORITHM_ES256 +>>>>>>> 406e896 (Presentation Activity (#459)) ) .generate() )