Skip to content

Commit

Permalink
Merge pull request #60 from sicpa-dlab/allow-empty-accept-service
Browse files Browse the repository at this point in the history
Allow empty array for `accept` field in service
  • Loading branch information
Artemkaaas authored Aug 18, 2022
2 parents bd8dfc9 + bad0432 commit 5a47a40
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/kotlin/org/didcommx/didcomm/diddoc/DIDDoc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ data class DIDCommService(
val id: String,
val serviceEndpoint: String,
val routingKeys: List<String>,
val accept: List<String>
val accept: List<String>?
)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
}
Expand Down

0 comments on commit 5a47a40

Please sign in to comment.