Skip to content

Commit

Permalink
Add mdoc verification
Browse files Browse the repository at this point in the history
  • Loading branch information
code28 committed Aug 25, 2024
1 parent 8e7451b commit 9706020
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ plugins {
}

dependencies {
implementation("id.walt:waltid-mdoc-jvm:1.2312081100.0")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencyResolutionManagement {
maven {
url = uri("https://jitpack.io")
}
maven("https://maven.walt.id/repository/waltid/")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import eu.europa.ec.eudi.verifier.endpoint.port.out.cfg.GenerateResponseCode
import eu.europa.ec.eudi.verifier.endpoint.port.out.jose.VerifyJarmJwtSignature
import eu.europa.ec.eudi.verifier.endpoint.port.out.persistence.LoadPresentationByRequestId
import eu.europa.ec.eudi.verifier.endpoint.port.out.persistence.StorePresentation
import id.walt.mdoc.doc.MDoc
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.slf4j.Logger
Expand Down Expand Up @@ -185,7 +186,29 @@ class PostWalletResponseLive(
logger.info("Successfully verified the sdjwt")
}

"mso_mdoc" -> print("mso_mdoc")
"mso_mdoc" -> {
val presentedMdoc = MDoc.fromCBORHex(token)

// val cryptoProvider = SimpleCOSECryptoProvider(listOf(
// COSECryptoProviderKeyInfo(ISSUER_KEY_ID, AlgorithmID.ECDSA_256, getIssuerEcKey, null)
// ))
//
// presentedMdoc.verify(
// MDocVerificationParams(
// VerificationType.ISSUER_SIGNATURE and VerificationType.VALIDITY,
// ),
// cryptoProvider
// )

// DEBUG OUTPUT, PRINT ALL ITEMS IN MDOC
presentedMdoc.nameSpaces.forEach { ns ->
println("Namespace: $ns")
presentedMdoc.getIssuerSignedItems(ns).forEach { issuerSignedItem ->
println("- ${issuerSignedItem.elementIdentifier.value}: ${issuerSignedItem.elementValue.value}")
}
}
}

"vc+sd-jwt+zkp" -> {
logger.info("Starting zkp verification for SDJWT")
val descriptorId: String = descriptor.id.value
Expand Down

0 comments on commit 9706020

Please sign in to comment.