@@ -10,13 +10,13 @@ import androidx.biometric.BiometricPrompt
10
10
import androidx.fragment.app.FragmentActivity
11
11
import com.android.identity.android.mdoc.util.CredmanUtil
12
12
import com.android.identity.android.securearea.AndroidKeystoreKeyUnlockData
13
- import com.android.identity.document.Credential
14
13
import com.android.identity.document.DocumentRequest
15
14
import com.android.identity.document.NameSpacedData
16
15
import com.android.identity.crypto.Algorithm
17
16
import com.android.identity.crypto.Crypto
18
17
import com.android.identity.crypto.EcCurve
19
18
import com.android.identity.crypto.EcPublicKeyDoubleCoordinate
19
+ import com.android.identity.mdoc.credential.MdocCredential
20
20
import com.android.identity.mdoc.mso.StaticAuthDataParser
21
21
import com.android.identity.mdoc.response.DeviceResponseGenerator
22
22
import com.android.identity.mdoc.response.DocumentGenerator
@@ -40,21 +40,21 @@ import java.util.StringTokenizer
40
40
class GetCredentialActivity : FragmentActivity () {
41
41
42
42
fun addDeviceNamespaces (documentGenerator : DocumentGenerator ,
43
- authKey : Credential ,
43
+ credential : MdocCredential ,
44
44
unlockData : KeyUnlockData ? ) {
45
45
documentGenerator.setDeviceNamespacesSignature(
46
46
NameSpacedData .Builder ().build(),
47
- authKey .secureArea,
48
- authKey .alias,
47
+ credential .secureArea,
48
+ credential .alias,
49
49
unlockData,
50
50
Algorithm .ES256 )
51
51
}
52
52
53
- fun doBiometricAuth (authKey : Credential ,
53
+ fun doBiometricAuth (credential : MdocCredential ,
54
54
forceLskf : Boolean ,
55
55
onBiometricAuthCompleted : (unlockData: KeyUnlockData ? ) -> Unit ) {
56
56
var title = " To share your credential we need to check that it's you."
57
- var unlockData = AndroidKeystoreKeyUnlockData (authKey .alias)
57
+ var unlockData = AndroidKeystoreKeyUnlockData (credential .alias)
58
58
var cryptoObject = unlockData.getCryptoObjectForSigning(Algorithm .ES256 )
59
59
60
60
val promptInfoBuilder = BiometricPrompt .PromptInfo .Builder ()
@@ -88,7 +88,7 @@ class GetCredentialActivity : FragmentActivity() {
88
88
Logger .d(" TAG" , " onAuthenticationError $errorCode $errString " )
89
89
// TODO: "Use LSKF"... without this delay, the prompt won't work correctly
90
90
Handler (Looper .getMainLooper()).postDelayed({
91
- doBiometricAuth(authKey , true , onBiometricAuthCompleted)
91
+ doBiometricAuth(credential , true , onBiometricAuthCompleted)
92
92
}, 100 )
93
93
}
94
94
}
@@ -128,7 +128,7 @@ class GetCredentialActivity : FragmentActivity() {
128
128
val credential = document.findCredential(
129
129
ProvisioningUtil .CREDENTIAL_DOMAIN ,
130
130
Timestamp .now()
131
- ) ? : throw IllegalStateException (" No credential" )
131
+ ) as MdocCredential ? ? : throw IllegalStateException (" No credential" )
132
132
val staticAuthData = StaticAuthDataParser (credential.issuerProvidedData).parse()
133
133
val mergedIssuerNamespaces = MdocUtil .mergeIssuerNamesSpaces(
134
134
documentRequest, nameSpacedData, staticAuthData
0 commit comments