Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

# Project properties
group=eu.europa.ec.eudi
version=0.4.1-SNAPSHOT
version=0.5.0-SNAPSHOT

# Sonar
systemProp.sonar.host.url=https://sonarcloud.io
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[versions]
dokka = "2.1.0"
kotlin = "2.1.21"
spotless = "6.25.0"
java = "17"
kotlinxSerialization = "1.8.1"
ktlint = "0.50.0"
kotlin = "2.2.21"
kotlinxSerialization = "1.9.0"
dokka = "2.2.0"
spotless = "8.4.0"
ktlint = "1.8.0"
dependencycheck = "12.1.1"
jsonKotlinSchema = "0.57"
jsonpathkt = "3.0.2"
mavenPublish = "0.34.0"
kover = "0.9.2"
mavenPublish = "0.35.0"
kover = "0.9.8"

[libraries]
kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
10 changes: 6 additions & 4 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("1.0.0")
id("org.gradle.toolchains.foojay-resolver-convention") version ("1.0.0")
}

rootProject.name = "eudi-lib-jvm-presentation-exchange-kt"
1 change: 0 additions & 1 deletion src/main/kotlin/eu/europa/ec/eudi/prex/JsonParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package eu.europa.ec.eudi.prex
import java.io.InputStream

interface JsonParser {

/**
* Tries to parse the given [inputStream] into a [PresentationDefinition].
* It is assumed that the [inputStream] corresponds to a Json object that either contains
Expand Down
13 changes: 8 additions & 5 deletions src/main/kotlin/eu/europa/ec/eudi/prex/JsonPathOps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.nfeld.jsonpathkt.JsonPath as ExternalJsonPath
* JSON Path related operations
*/
internal object JsonPathOps {

/**
* Checks that the provided [path][String] is JSON Path
*/
Expand All @@ -34,13 +33,17 @@ internal object JsonPathOps {
* Extracts from given [JSON][jsonString] the content
* at [path][jsonPath]. Returns the value found at the path, if found
*/
internal fun getJsonAtPath(jsonPath: JsonPath, jsonString: String): String? =
internal fun getJsonAtPath(
jsonPath: JsonPath,
jsonString: String,
): String? =
ExternalJsonPath
.compile(jsonPath.value)
.resolveOrNull(JsonSupport.parseToJsonElement(jsonString))
?.let { JsonSupport.encodeToString(it) }

private fun String.toJsonPath(): Result<ExternalJsonPath> = runCatching {
ExternalJsonPath.compile(this)
}
private fun String.toJsonPath(): Result<ExternalJsonPath> =
runCatching {
ExternalJsonPath.compile(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import eu.europa.ec.eudi.prex.internal.DefaultPresentationMatcher
* Entry point to the Presentation Exchange library
*/
object PresentationExchange {

/**
* JSON serialization/deserialization
*/
Expand Down
35 changes: 26 additions & 9 deletions src/main/kotlin/eu/europa/ec/eudi/prex/PresentationMatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import eu.europa.ec.eudi.prex.InputDescriptorEvaluation.NotMatchedFieldConstrain
* The outcome of applying a [FieldConstraint] to a claim.
*/
sealed interface FieldQueryResult {

/**
* Indicates that a [FieldConstraint] is not satisfied by a claim
*/
Expand All @@ -41,13 +40,19 @@ sealed interface FieldQueryResult {
* where the Verifier asks from the wallet to evaluate a predicate
*/
sealed interface CandidateField : FieldQueryResult {

/**
* Indicates that a [FieldConstraint] was satisfied by a claim because (the claim) it
* contains at [path] an appropriate [content]
*/
data class Found(val path: JsonPath, val content: String) : CandidateField
data class PredicateEvaluated(val path: JsonPath, val predicateEvaluation: Boolean) : CandidateField
data class Found(
val path: JsonPath,
val content: String,
) : CandidateField

data class PredicateEvaluated(
val path: JsonPath,
val predicateEvaluation: Boolean,
) : CandidateField

/**
* Indicates that the claim doesn't contain a field as described in the [FieldConstraint]
Expand All @@ -63,11 +68,12 @@ sealed interface FieldQueryResult {
* The outcome of evaluating an [InputDescriptor] against a [Claim]
*/
sealed interface InputDescriptorEvaluation {

/**
* Indicates that claim is candidate, that is matches, the given [InputDescriptor]
*/
data class CandidateClaim(val matches: Map<FieldConstraint, CandidateField>) : InputDescriptorEvaluation {
data class CandidateClaim(
val matches: Map<FieldConstraint, CandidateField>,
) : InputDescriptorEvaluation {
init {
require(matches.isNotEmpty())
}
Expand All @@ -77,9 +83,11 @@ sealed interface InputDescriptorEvaluation {
* Indicates that claim doesn't satisfy the constraints of the [InputDescriptor]
*/
sealed interface NotMatchingClaim : InputDescriptorEvaluation

data object NotMatchedFieldConstraints : NotMatchingClaim {
private fun readResolve(): Any = NotMatchedFieldConstraints
}

data object UnsupportedFormat : NotMatchingClaim {
private fun readResolve(): Any = UnsupportedFormat
}
Expand All @@ -90,14 +98,20 @@ typealias ClaimId = String
interface Claim {
val uniqueId: ClaimId
val format: Format

fun asJsonString(): String
}

typealias InputDescriptorEvalPerClaim<A> = Map<InputDescriptorId, Map<ClaimId, A>>

sealed interface Match {
data class Matched(val matches: InputDescriptorEvalPerClaim<CandidateClaim>) : Match
data class NotMatched(val details: InputDescriptorEvalPerClaim<NotMatchedFieldConstraints>) : Match
data class Matched(
val matches: InputDescriptorEvalPerClaim<CandidateClaim>,
) : Match

data class NotMatched(
val details: InputDescriptorEvalPerClaim<NotMatchedFieldConstraints>,
) : Match
}

/**
Expand All @@ -107,5 +121,8 @@ sealed interface Match {
* @see <a href="https://identity.foundation/presentation-exchange/spec/v2.0.0/#input-evaluation">Input evaluation</a>
*/
fun interface PresentationMatcher {
fun match(pd: PresentationDefinition, claims: List<Claim>): Match
fun match(
pd: PresentationDefinition,
claims: List<Claim>,
): Match
}
Loading
Loading