@@ -194,12 +194,13 @@ class CreateCredentialViewModel : ViewModel() {
194194 Log .i(TAG , " credentialResponse $credentialResponse " )
195195 val config = openId4VCI.credentialOffer.issuerMetadata.credentialConfigurationsSupported[authDetail.credentialConfigurationId]!!
196196 val display = credentialResponse.display?.firstOrNull()
197+ val displayFromOffer = config.credentialMetadata?.display?.firstOrNull()
197198 val newCredentialItem = CredentialItem (
198199 id = Uuid .random().toHexString(),
199200 config = config,
200201 displayData = CredentialDisplayData (
201- title = display?.name ? : " Unknown" ,
202- subtitle = display?.description,
202+ title = display?.name ? : displayFromOffer?.name ? : " Unknown" ,
203+ subtitle = display?.description ? : displayFromOffer?.description ,
203204 icon = display?.logo?.uri.imageUriToImageB64()
204205 ),
205206 credentials = credentialResponse.credentials!! .map {
@@ -214,6 +215,16 @@ class CreateCredentialViewModel : ViewModel() {
214215 x == deviceKey.first && y == deviceKey.second
215216 }
216217 }
218+ is CredentialConfigurationSdJwtVc -> {
219+ val issuerJwtString = it.credential.split(' ~' )[0 ]
220+ val cnfKey = IssuerJwt (issuerJwtString).payload.getJSONObject(" cnf" ).getJSONObject(" jwk" )
221+ deviceKeys.firstOrNull {
222+ val public = it.public as ECPublicKey
223+ val x = public.w.affineX.toFixedByteArray(32 ).toBase64UrlNoPadding()
224+ val y = public.w.affineY.toFixedByteArray(32 ).toBase64UrlNoPadding()
225+ x == cnfKey.getString(" x" ) && y == cnfKey.getString(" y" )
226+ }
227+ }
217228 else -> throw UnsupportedOperationException (" Unknown configuration $config " )
218229 }
219230
0 commit comments