Skip to content

Commit

Permalink
Merge branch 'release/0.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Oct 3, 2019
2 parents e97864b + 83ee2a8 commit c28cafd
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,14 @@ so that only tokens intended for your app are considered valid.

## CHANGELOG

* 0.3.3
- refactor: use kethereum 0.76.2 ( 1f730e39 )
- bugfix: resolve publicKey entries with null chars in their names ( #27 )
* 0.3.2
- feat: support multi-network ethr-did ( #20 )
- refactor: use lowercase coordinates for kethereum libs ( #21 )
- bugfix: crash in ethr-did-resolver when nodes don't reply with logs ( #21 )
- refactor: use kethereum 0.76.1 and kotlin-common 0.3.1 ( #22 )
- refactor: use lowercase coordinates for kethereum libs ( #25 )
* 0.3.1
- allow override or removal of `iat` field when creating JWTs (#17)
* 0.3.0
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ buildscript {
okhttp_version = "3.14.1"

bivrost_version = "v0.7.1"
kmnid_version = "0.4.1"
kethereum_version = "0.76.1"
kmnid_version = "0.4.2"
kethereum_version = "0.76.2"
khex_version = "1.0.0-RC3"
spongycastle_version = "1.58.0.0"
uport_kotlin_common_version = "0.3.1"
uport_kotlin_common_version = "0.3.2"

current_release_version = "0.3.2"
current_release_version = "0.3.3"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ open class EthrDIDResolver : DIDResolver {
)
}

private fun processAttributeChanged(
internal fun processAttributeChanged(
event: DIDAttributeChanged.Arguments,
delegateCount: Int,
normalizedDid: String
Expand All @@ -260,7 +260,7 @@ open class EthrDIDResolver : DIDResolver {
if (validTo < _timeProvider.nowMs() / 1000L) {
return (pkEntries to serviceEntries)
}
val name = event.name.byteArray.bytes32ToString()
val name = event.name.byteArray.bytes32ToString().replace("\u0000", "")
val key = "DIDAttributeChanged-$name-${event.value.items.toHexString()}"

//language=RegExp
Expand Down
34 changes: 34 additions & 0 deletions ethr-did/src/test/java/me/uport/sdk/ethrdid/EthrDIDResolverTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import me.uport.sdk.signer.hexToBytes32
import me.uport.sdk.signer.utf8
import me.uport.sdk.testhelpers.coAssert
import me.uport.sdk.universaldid.DidResolverError
import me.uport.sdk.universaldid.PublicKeyEntry
import me.uport.sdk.universaldid.PublicKeyType
import me.uport.sdk.universaldid.ServiceEntry
import org.junit.Test
import org.kethereum.extensions.hexToBigInteger
import pm.gnosis.model.Solidity
Expand Down Expand Up @@ -804,6 +807,37 @@ class EthrDIDResolverTest {
}
}

@Test
fun `parses attribute changed event with trailing null chars`() = runBlocking {
val resolver = EthrDIDResolver.Builder().build()

val event = EthereumDIDRegistry.Events.DIDAttributeChanged.Arguments(
identity = Solidity.Address(BigInteger("1318742768210968905798991064222156353846287247782")),
name = Solidity.Bytes32("0x6469642f7075622f736563703235366b312f766572694b65792f686578000000".hexToByteArray()),
value = Solidity.Bytes("0x0295dda1dca7f80e308ef60155ddeac00e46b797fd40ef407f422e88d2467a27eb".hexToByteArray()),
validto = Solidity.UInt256(BigInteger("12004335415")),
previouschange = Solidity.UInt256(BigInteger.ZERO)
)

val res: Pair<Map<String, PublicKeyEntry>, Map<String, ServiceEntry>> =
resolver.processAttributeChanged(
event,
0,
"did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6"
)

assertThat(res).isEqualTo(
mapOf(
"DIDAttributeChanged-did/pub/secp256k1/veriKey/hex-0x0295dda1dca7f80e308ef60155ddeac00e46b797fd40ef407f422e88d2467a27eb" to PublicKeyEntry(
id = "did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#delegate-1",
type = PublicKeyType("secp256k1VerificationKey2018"),
owner = "did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6",
publicKeyHex = "0x0295dda1dca7f80e308ef60155ddeac00e46b797fd40ef407f422e88d2467a27eb"
)
) to emptyMap<String, ServiceEntry>()
)
}

@Test
fun `throws DidResolverError when RPC returns error`() {
val rpc = mockk<JsonRPC>()
Expand Down

0 comments on commit c28cafd

Please sign in to comment.