From a86bcc3d7601741602432d6328e83b60e4dcf1e1 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Tue, 15 Aug 2023 11:09:27 -0700 Subject: [PATCH] fix: document get separator (#40) * feat: add fetchIdentityFromPubKeyHash to StateRepository * fix: use . for path separator --- src/main/kotlin/org/dashj/platform/dpp/StateRepository.kt | 2 ++ src/main/kotlin/org/dashj/platform/dpp/document/Document.kt | 2 +- src/test/kotlin/org/dashj/platform/dpp/StateRepositoryMock.kt | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/dashj/platform/dpp/StateRepository.kt b/src/main/kotlin/org/dashj/platform/dpp/StateRepository.kt index 4c80ab0..ebb1f0f 100644 --- a/src/main/kotlin/org/dashj/platform/dpp/StateRepository.kt +++ b/src/main/kotlin/org/dashj/platform/dpp/StateRepository.kt @@ -46,6 +46,8 @@ interface StateRepository { */ fun fetchIdentity(id: Identifier): Identity? + fun fetchIdentityFromPubKeyHash(pubKeyHash: ByteArray): Identity? + fun storeIdentity(identity: Identity) fun storeIdentityPublicKeyHashes(identity: Identifier, publicKeyHashes: List) diff --git a/src/main/kotlin/org/dashj/platform/dpp/document/Document.kt b/src/main/kotlin/org/dashj/platform/dpp/document/Document.kt index b2d3684..9c59d29 100644 --- a/src/main/kotlin/org/dashj/platform/dpp/document/Document.kt +++ b/src/main/kotlin/org/dashj/platform/dpp/document/Document.kt @@ -94,7 +94,7 @@ class Document(rawDocument: Map, dataContract: DataContract) : Bas } fun get(path: String): Any? { - val keys = path.split("/") + val keys = path.split('.') var value: Any? = data for (key in keys) { if ((value as Map).containsKey(key)) { diff --git a/src/test/kotlin/org/dashj/platform/dpp/StateRepositoryMock.kt b/src/test/kotlin/org/dashj/platform/dpp/StateRepositoryMock.kt index c7e1d97..5e9939c 100644 --- a/src/test/kotlin/org/dashj/platform/dpp/StateRepositoryMock.kt +++ b/src/test/kotlin/org/dashj/platform/dpp/StateRepositoryMock.kt @@ -36,6 +36,10 @@ open class StateRepositoryMock : StateRepository { return null } + override fun fetchIdentityFromPubKeyHash(pubKeyHash: ByteArray): Identity? { + TODO("Not yet implemented") + } + override fun storeIdentity(identity: Identity) { TODO("Not yet implemented") }