-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #682 from walt-id/update-structure_presentation-pa…
…rser Update structure, initial presentation definition parser
- Loading branch information
Showing
528 changed files
with
1,835 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
enabledFeatures = [ | ||
"registration-defaults", | ||
] | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
waltid-libraries/credentials/waltid-dif-presentation-exchange/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
kotlin("plugin.serialization") | ||
id("maven-publish") | ||
id("dev.petuska.npm.publish") version "3.4.3" | ||
// id("love.forte.plugin.suspend-transform") version "2.0.20-Beta1-0.9.2" | ||
id("com.github.ben-manes.versions") | ||
} | ||
|
||
group = "id.walt.dif-presentation-exchange" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
|
||
jvm { | ||
@OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
compilerOptions { | ||
jvmTarget = JvmTarget.JVM_17 | ||
} | ||
withJava() | ||
tasks.withType<Test>().configureEach { | ||
useJUnitPlatform() | ||
} | ||
} | ||
|
||
js(IR) { | ||
moduleName = "presentation-exchange" | ||
nodejs { | ||
generateTypeScriptDefinitions() | ||
} | ||
binaries.library() | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation("com.eygraber:jsonpathkt-kotlinx:3.0.2") | ||
// JSON | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") | ||
implementation("io.github.optimumcode:json-schema-validator:0.2.2") | ||
|
||
implementation(project(":waltid-libraries:credentials:waltid-verifiable-credentials")) | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
//implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1") | ||
} | ||
} | ||
val jvmTest by getting { | ||
dependencies { | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") | ||
implementation("org.slf4j:slf4j-simple:2.0.13") | ||
} | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
...ion-exchange/src/commonMain/kotlin/id/walt/presentationexchange/PresentationDefinition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package id.walt.presentationexchange | ||
|
||
import kotlinx.serialization.* | ||
import kotlinx.serialization.json.* | ||
|
||
@Serializable | ||
data class PresentationDefinition( | ||
val id: String, | ||
val name: String? = null, | ||
val purpose: String? = null, | ||
val format: JsonObject? = null, | ||
val frame: Map<String, JsonElement>? = null, | ||
@SerialName("submission_requirements") | ||
val submissionRequirements: List<SubmissionRequirement>? = null, | ||
@SerialName("input_descriptors") | ||
val inputDescriptors: List<InputDescriptor> | ||
) { | ||
@Serializable | ||
data class InputDescriptor( | ||
val id: String, | ||
val name: String? = null, | ||
val purpose: String? = null, | ||
val format: JsonElement? = null, | ||
val group: List<String>? = null, | ||
val constraints: Constraints | ||
) { | ||
@Suppress("EnumEntryName") | ||
enum class Directive { | ||
required, | ||
preferred, | ||
disallowed | ||
} | ||
|
||
@Serializable | ||
data class Constraints( | ||
@SerialName("limit_disclosure") | ||
val limitDisclosure: Directive? = null, | ||
val statuses: Statuses? = null, | ||
val fields: List<Field>? = null, | ||
@SerialName("subject_is_issuer") | ||
val subjectIsIssuer: String? = null, | ||
@SerialName("is_holder") | ||
val isHolder: List<Subject>? = null, | ||
@SerialName("same_subject") | ||
val sameSubject: List<Subject>? = null | ||
) { | ||
|
||
|
||
@Serializable | ||
data class Statuses( | ||
val active: StatusDirective? = null, | ||
val suspended: StatusDirective? = null, | ||
val revoked: StatusDirective? = null | ||
) | ||
|
||
@Serializable | ||
data class Field( | ||
val id: String? = null, | ||
val optional: Boolean? = null, | ||
val path: List<String>, | ||
val purpose: String? = null, | ||
val name: String? = null, | ||
@SerialName("intent_to_retain") | ||
val intentToRetain: Boolean? = null, | ||
val filter: JsonElement? = null, | ||
val predicate: String? = null | ||
) | ||
|
||
@Serializable | ||
data class Subject( | ||
@SerialName("field_id") | ||
val fieldId: List<String>, | ||
val directive: Directive | ||
) | ||
|
||
@Serializable | ||
data class StatusDirective( | ||
val type: List<String>, | ||
val directive: Directive, | ||
) { | ||
init { | ||
check(type.isNotEmpty()) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.