Skip to content

Commit

Permalink
Fix: MDoc Verification
Browse files Browse the repository at this point in the history
  • Loading branch information
josmilan committed Oct 3, 2024
1 parent 6090a2f commit d5ecdc3
Show file tree
Hide file tree
Showing 8 changed files with 758 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ data class InputDescriptors(

@SerializedName("id") var id: String? = null,
@SerializedName("name") var name: String? = null,
@SerializedName("format") var format: Map<String, Jwt>? = mapOf(),
@SerializedName("constraints") var constraints: Constraints? = null

)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ data class CredentialDetails(
@SerializedName("cryptographic_binding_methods_supported") val cryptographicBindingMethodsSupported: List<String>? = null,
@SerializedName("cryptographic_suites_supported") val cryptographicSuitesSupported: List<String>? = null,
@SerializedName("display") val display: List<CredentialDisplay>? = null,
@SerializedName("doctype") val doctype: String? = null,
@SerializedName("credential_definition") val credentialDefinition: Any? = null
)
data class CredentialDisplay(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ewc.eudi_wallet_oidc_android.models


import com.google.gson.annotations.SerializedName

data class PresentationSubmissionMdoc(

@SerializedName("id") var id: String? = null,
@SerializedName("definition_id") var definitionId: String? = null,
@SerializedName("descriptor_map") var descriptorMap: ArrayList<DescriptorMapMdoc> = arrayListOf()

)

data class DescriptorMapMdoc(

@SerializedName("id") var id: String? = null,
@SerializedName("path") var path: String? = null,
@SerializedName("format") var format: String? = null,

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.ewc.eudi_wallet_oidc_android.models

import co.nstant.`in`.cbor.model.Array as CborArray
import co.nstant.`in`.cbor.model.ByteString
import co.nstant.`in`.cbor.model.Map as CborMap

data class VpToken(
val version: String,
val documents: List<Document>,
val status: Int
)

data class Document(
val docType: String,
val issuerSigned: IssuerSigned,
val deviceSigned: DeviceSigned?
)

data class IssuerSigned(
val nameSpaces: CborMap,
val issuerAuth: CborArray
)

data class DeviceSigned(
val nameSpaces: ByteString,
val deviceAuth: DeviceAuth
)

data class DeviceAuth(
val deviceSignature: List<Any>
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.ewc.eudi_wallet_oidc_android.services.UriValidationFailed
import com.ewc.eudi_wallet_oidc_android.services.UrlUtils
import com.ewc.eudi_wallet_oidc_android.services.codeVerifier.CodeVerifierService
import com.ewc.eudi_wallet_oidc_android.services.network.ApiManager
import com.ewc.eudi_wallet_oidc_android.services.utils.CborUtils
import com.google.gson.Gson
import com.nimbusds.jose.JOSEObjectType
import com.nimbusds.jose.JWSAlgorithm
Expand Down Expand Up @@ -92,16 +93,14 @@ class IssueService : IssueServiceInterface {
codeVerifier: String,
authorisationEndPoint: String?,
format: String?,
docType: String?
): String? {
val responseType = "code"
val types = getTypesFromCredentialOffer(credentialOffer)
val scope = if (format == "mso_mdoc") { "${types.firstOrNull() ?: ""} openid" } else { "openid" }
val doctype = if (format == "mso_mdoc") "org.iso.18013.5.1.mDL" else null
// val doctype = if (format == "mso_mdoc") "${types.firstOrNull()}" else null

val state = UUID.randomUUID().toString()
val clientId = did
val authorisationDetails = buildAuthorizationRequest(credentialOffer, format, doctype)
val authorisationDetails = buildAuthorizationRequest(credentialOffer, format, docType)

val redirectUri = "http://localhost:8080"
val nonce = UUID.randomUUID().toString()
Expand Down Expand Up @@ -227,7 +226,7 @@ class IssueService : IssueServiceInterface {
} catch (e: Exception) {
credentialDefinitionNeeded = true
}
if (format == "mso_mdoc"){
if (format == "mso_mdoc" && doctype != null){
return gson.toJson(
arrayListOf(
AuthorizationDetails(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ interface IssueServiceInterface {
credentialOffer: CredentialOffer?,
codeVerifier: String,
authorisationEndPoint: String?,
format: String? = "jwt_vc_json"
format: String? = "jwt_vc_json",
docType: String? =null
): String?

/**
Expand Down
Loading

0 comments on commit d5ecdc3

Please sign in to comment.