Skip to content

Commit 640319c

Browse files
committed
Merge branch 'release/0.3.6'
2 parents c269b10 + 6a590f1 commit 640319c

File tree

54 files changed

+946
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+946
-240
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
# upload test coverage report!
4747
- run: bash <(curl -s https://codecov.io/bash)
4848

49+
# run linter
50+
- run: ./gradlew detekt
51+
- store_artifacts:
52+
path: ./build/reports
53+
4954
workflows:
5055
version: 2
5156
workflow:

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ allprojects {
6363
In your application `build.gradle` file, add:
6464

6565
```groovy
66-
def did_jwt_version = "0.3.5"
66+
def did_jwt_version = "0.3.6"
6767
dependencies {
6868
//...
6969
implementation "com.github.uport-project.kotlin-did-jwt:jwt:$did_jwt_version"
@@ -149,6 +149,10 @@ so that only tokens intended for your app are considered valid.
149149

150150
## CHANGELOG
151151

152+
* 0.3.6
153+
- fix: okhttp dependency issue (#43)
154+
- docs: mark UportDIDResolver as deprecated
155+
- refactor: code cleanup, enforcing detekt on PRs
152156
* 0.3.5
153157
- feat: add credential status / revocation support (#35)(#42)
154158
- support: bump dependencies (#44)

build.gradle

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@
33
buildscript {
44

55
ext {
6-
kotlin_version = '1.3.70'
7-
kotlin_serialization_version = '0.20.0'
6+
kotlin_version = "1.3.70"
7+
kotlin_serialization_version = "0.20.0"
88
coroutines_version = "1.3.5"
99

1010
junit_version = "4.12"
1111
mockk_version = "1.9.3"
12-
assertk_version = "0.13"
13-
detekt_version = "1.0.0-RC14"
12+
assertk_version = "0.22"
13+
detekt_version = "1.6.0"
1414
jacoco_version = "0.8.4"
1515

16-
okhttp_version = "4.4.1"
17-
1816
bivrost_version = "v0.7.1"
1917
kmnid_version = "0.4.4"
2018
kethereum_version = "0.81.4"
2119
khex_version = "1.0.0-RC6"
2220
khash_version = "1.0.0-RC5"
2321
kbase58_version = "0.1"
2422
spongycastle_version = "1.58.0.0"
25-
uport_kotlin_common_version = "0.4.2"
23+
uport_kotlin_common_version = "0.4.3"
2624

27-
current_release_version = "0.3.5"
25+
current_release_version = "0.3.6"
2826
}
2927

3028
repositories {
@@ -56,8 +54,8 @@ detekt {
5654
input = files(
5755
"$projectDir"
5856
)
59-
//config = "${projectDir}/detekt.yml"
60-
filters = ".*test.*,.*/resources/.*,.*/tmp/.*,.*/build/.*"
57+
config = files("${projectDir}/detekt.yml")
58+
baseline = file("${projectDir}/detekt_baseline.xml")
6159
parallel = true
6260
reports {
6361
xml {
@@ -73,7 +71,7 @@ detekt {
7371

7472
allprojects {
7573

76-
apply plugin: 'jacoco'
74+
apply plugin: "jacoco"
7775

7876
jacoco {
7977
toolVersion = jacoco_version
@@ -82,7 +80,7 @@ allprojects {
8280
repositories {
8381
google()
8482
jcenter()
85-
maven { url 'https://jitpack.io' }
83+
maven { url "https://jitpack.io" }
8684
maven { url "https://kotlin.bintray.com/kotlinx" }
8785
// mavenLocal()
8886
}
@@ -96,9 +94,9 @@ allprojects {
9694
}
9795
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
9896
def requested = details.requested
99-
if (requested.group == 'org.jetbrains.kotlin' && requested.name in [
100-
'kotlin-reflect', 'kotlin-stdlib', 'kotlin-stdlib-common',
101-
'kotlin-stdlib-jdk7', 'kotlin-stdlib-jdk8',
97+
if (requested.group == "org.jetbrains.kotlin" && requested.name in [
98+
"kotlin-reflect", "kotlin-stdlib", "kotlin-stdlib-common",
99+
"kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8",
102100
]) {
103101
details.useVersion kotlin_version
104102
}

credential-status/src/main/java/me/uport/credential_status/StatusResolver.kt renamed to credential-status/src/main/java/me/uport/credentialstatus/StatusResolver.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.uport.credential_status
1+
package me.uport.credentialstatus
22

33
import me.uport.sdk.universaldid.DIDDocument
44

@@ -41,4 +41,4 @@ interface StatusResolver {
4141
* Checks the status of a given credential and returns a [CredentialStatus] or throws an error
4242
*/
4343
suspend fun checkStatus(credential: String, didDoc: DIDDocument): CredentialStatus
44-
}
44+
}

credential-status/src/main/java/me/uport/credential_status/UniversalStatusResolver.kt renamed to credential-status/src/main/java/me/uport/credentialstatus/UniversalStatusResolver.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
package me.uport.credential_status
1+
package me.uport.credentialstatus
22

33
import me.uport.sdk.universaldid.DIDDocument
4-
import me.uport.sdk.universaldid.UniversalDID.method
5-
import me.uport.sdk.universaldid.UniversalDID.registerResolver
64

75
/**
86
*
@@ -36,12 +34,13 @@ class UniversalStatusResolver : StatusResolver {
3634

3735
val statusEntry = getStatusEntry(credential)
3836

39-
if (statusEntry.type.isBlank() || !resolvers.containsKey(statusEntry.type)) {
40-
throw IllegalStateException("There is no StatusResolver registered to check status using '${statusEntry.type}' method.")
41-
} else {
42-
return resolvers[statusEntry.type]?.checkStatus(credential, didDoc)
43-
?: throw IllegalStateException("There StatusResolver for '$statusEntry.type' failed to resolve for an unknown reason.")
37+
val resolver = resolvers[statusEntry.type]
38+
39+
check(statusEntry.type.isNotBlank() && resolver != null) {
40+
"There is no StatusResolver registered to check status using '${statusEntry.type}' method."
4441
}
42+
43+
return resolver.checkStatus(credential, didDoc)
4544
}
4645

4746

@@ -54,4 +53,4 @@ class UniversalStatusResolver : StatusResolver {
5453
}
5554
resolvers[resolver.method] = resolver
5655
}
57-
}
56+
}

credential-status/src/main/java/me/uport/credential_status/Utils.kt renamed to credential-status/src/main/java/me/uport/credentialstatus/Utils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.uport.credential_status
1+
package me.uport.credentialstatus
22

33
import me.uport.sdk.jwt.JWTTools
44

@@ -15,4 +15,4 @@ fun getStatusEntry(credential: String): StatusEntry {
1515
status["type"] ?: "",
1616
status["id"] ?: ""
1717
)
18-
}
18+
}

credential-status/src/test/java/me/uport/sdk/credential_status/UniversalStatusResolverTests.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
package me.uport.sdk.credential_status
44

5+
import assertk.all
56
import assertk.assertThat
67
import assertk.assertions.isEqualTo
8+
import assertk.assertions.isFailure
79
import assertk.assertions.isInstanceOf
810
import kotlinx.coroutines.runBlocking
9-
import me.uport.credential_status.CredentialStatus
10-
import me.uport.credential_status.StatusResolver
11-
import me.uport.credential_status.UniversalStatusResolver
11+
import me.uport.credentialstatus.CredentialStatus
12+
import me.uport.credentialstatus.StatusResolver
13+
import me.uport.credentialstatus.UniversalStatusResolver
1214
import me.uport.sdk.ethrdid.EthrDIDDocument
1315
import me.uport.sdk.testhelpers.coAssert
1416
import me.uport.sdk.universaldid.DIDDocument
@@ -58,9 +60,10 @@ class UniversalStatusResolverTests {
5860
coAssert {
5961
UniversalStatusResolver().checkStatus(
6062
"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NzMwNDczNTEsInN0YXR1cyI6eyJ0eXBlIjoiRXRoclN0YXR1c1JlZ2lzdHJ5MjAxOSIsImlkIjoicmlua2VieToweDFFNDY1MWRjYTVFZjM4NjM2ZTJFNEQ3QTZGZjRkMjQxM2ZDNTY0NTAifSwiaXNzIjoiZGlkOmV0aHI6MHgxZmNmOGZmNzhhYzUxMTdkOWM5OWI4MzBjNzRiNjY2OGQ2YWMzMjI5In0.MHabafA0UxJuQJ0Z-7Egb57WRlgj4_zf96B0LUhRyXgVDU5RABIczTTTXWjcuKVzhJc_-FuhRI8uQYmQQNxKzgA"
61-
, didDoc
63+
,
64+
didDoc
6265
)
63-
}.thrownError {
66+
}.isFailure().all {
6467
isInstanceOf(IllegalStateException::class)
6568
}
6669
}
@@ -74,7 +77,7 @@ class UniversalStatusResolverTests {
7477
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
7578
didDoc
7679
)
77-
}.thrownError {
80+
}.isFailure().all {
7881
isInstanceOf(IllegalArgumentException::class)
7982
}
8083
}
@@ -86,4 +89,4 @@ class UniversalStatusResolverTests {
8689
val result = resolver.checkStatus(successfulCred, didDoc)
8790
assertThat(result).isEqualTo(TestStatus(BigInteger.ONE))
8891
}
89-
}
92+
}

0 commit comments

Comments
 (0)