diff --git a/gradle.properties b/gradle.properties index e1f379c..c7abff7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -version=0.3.1 +version=0.3.2 group=org.didcommx kotlinJvm=1.5.21 diff --git a/lib/build.gradle b/lib/build.gradle index 72c0ce0..0429736 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -22,13 +22,21 @@ kotlin { dependencies { implementation "com.nimbusds:nimbus-jose-jwt:${nimbusJoseJWTVersion}" implementation "com.github.multiformats:java-multibase:${javaMultibase}" - shadow "com.google.crypto.tink:tink:${googleTinkVersion}" + implementation "com.google.code.gson:gson:2.9.0" + implementation 'com.google.protobuf:protobuf-java:3.20.1' + shadow("com.google.crypto.tink:tink:${googleTinkVersion}") { + exclude group: 'com.google.code.gson', module: 'gson' + exclude group: 'com.google.protobuf', module: 'protobuf-java' + } shadow "com.zmannotes:varint:${zmanVarint}" // implementation 'org.bouncycastle:bcprov-jdk15on:1.69' // TODO look for a better solution // currently it's a workaround for shadow of the above deps - testImplementation "com.google.crypto.tink:tink:${googleTinkVersion}" + testImplementation("com.google.crypto.tink:tink:${googleTinkVersion}") { + exclude group: 'com.google.code.gson', module: 'gson' + exclude group: 'com.google.protobuf', module: 'protobuf-java' + } testImplementation "com.zmannotes:varint:${zmanVarint}" testImplementation "org.jetbrains.kotlin:kotlin-test" diff --git a/lib/src/main/kotlin/org/didcommx/didcomm/diddoc/DIDDoc.kt b/lib/src/main/kotlin/org/didcommx/didcomm/diddoc/DIDDoc.kt index f1d83ef..205b6bb 100644 --- a/lib/src/main/kotlin/org/didcommx/didcomm/diddoc/DIDDoc.kt +++ b/lib/src/main/kotlin/org/didcommx/didcomm/diddoc/DIDDoc.kt @@ -64,5 +64,5 @@ data class DIDCommService( val id: String, val serviceEndpoint: String, val routingKeys: List, - val accept: List + val accept: List? ) diff --git a/lib/src/main/kotlin/org/didcommx/didcomm/protocols/routing/Routing.kt b/lib/src/main/kotlin/org/didcommx/didcomm/protocols/routing/Routing.kt index e784b06..1f988d3 100644 --- a/lib/src/main/kotlin/org/didcommx/didcomm/protocols/routing/Routing.kt +++ b/lib/src/main/kotlin/org/didcommx/didcomm/protocols/routing/Routing.kt @@ -60,7 +60,7 @@ internal fun findDIDCommService( if (serviceId != null) { val didService = didDoc.findDIDCommService(serviceId) - if (PROFILE_DIDCOMM_V2 !in didService.accept) { + if (didService.accept != null && !didService.accept.isEmpty() && PROFILE_DIDCOMM_V2 !in didService.accept) { throw DIDCommServiceException( toDid, "service '$serviceId' does not accept didcomm/v2 profile" ) @@ -73,7 +73,7 @@ internal fun findDIDCommService( // > by protocol availability or preference. // https://identity.foundation/didcomm-messaging/spec/#multiple-endpoints return try { - didDoc.didCommServices.find { PROFILE_DIDCOMM_V2 in it.accept } + didDoc.didCommServices.find { it.accept == null || it.accept.isEmpty() || PROFILE_DIDCOMM_V2 in it.accept } } catch (e: DIDDocException) { null }