Skip to content

Commit

Permalink
Merge pull request #58 from nadraliev/main
Browse files Browse the repository at this point in the history
release-0.3.1
  • Loading branch information
ashcherbakov authored Jun 1, 2022
2 parents 9b43ee2 + 37203a3 commit b1d4924
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Available from Maven Central.
Gradle:
```
dependencies {
implementation 'org.didcommx:didcomm:0.1.0'
implementation 'org.didcommx:didcomm:0.3.0'
}
```

Expand All @@ -23,7 +23,7 @@ Maven:
<dependency>
<groupId>org.didcommx</groupId>
<artifactId>didcomm</artifactId>
<version>0.1.0</version>
<version>0.3.0</version>
</dependency>
```

Expand Down Expand Up @@ -53,8 +53,8 @@ See https://github.com/sicpa-dlab/didcomm-demo.
- Curves: Ed25519, Secp256k1 (currently JDK < 15 only), P-256
- Algorithms: EdDSA (with crv=Ed25519), ES256, ES256K (currently JDK < 15 only)
- DID rotation (`fromPrior` field) is supported.
- Forward protocol is implemented and used by default.
- Limitations and known issues:
- Forward protocol is not implemented
- Secp256k1 is supported on JDK < 15 only
- DIDComm has been implemented under the following [Assumptions](https://hackmd.io/i3gLqgHQR2ihVFV5euyhqg)

Expand Down
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.0
version=0.3.1
group=org.didcommx

kotlinJvm=1.5.21
Expand Down
5 changes: 2 additions & 3 deletions lib/src/main/kotlin/org/didcommx/didcomm/utils/JSONUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package org.didcommx.didcomm.utils

import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import com.nimbusds.jose.shaded.json.JSONArray
import com.nimbusds.jose.util.JSONObjectUtils
import org.didcommx.didcomm.exceptions.MalformedMessageException

inline fun <reified T> Map<String, Any?>.getTypedArray(key: String): Array<T?>? = this[key]?.let {
if (it !is JSONArray) throw MalformedMessageException("The expected type of header '$key' is 'JSONArray'. Got '${it::class.simpleName}'")
if (it !is List<*>) throw MalformedMessageException("The expected type of header '$key' is 'List'. Got '${it::class.simpleName}'")
else it.getTyped(key)
}

Expand All @@ -16,7 +15,7 @@ inline fun <reified T> Map<String, Any?>.getTyped(key: String): T? = this[key]?.
else it
}

inline fun <reified T> JSONArray.getTyped(key: String): Array<T?> = this.map {
inline fun <reified T> List<*>.getTyped(key: String): Array<T?> = this.map {
when (it) {
null -> null
!is T -> throw MalformedMessageException("The expected type of header '$key' is '${T::class.simpleName}'. Got '${it::class.simpleName}'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ class JWM {
"attachments": "131"
}
""".trimIndent(),
"The expected type of header 'attachments' is 'JSONArray'. Got 'String'"
"The expected type of header 'attachments' is 'List'. Got 'String'"
),

WrongMessage(
Expand Down

0 comments on commit b1d4924

Please sign in to comment.