Skip to content

Commit

Permalink
fix: document get separator (#40)
Browse files Browse the repository at this point in the history
* feat: add fetchIdentityFromPubKeyHash to StateRepository

* fix: use . for path separator
  • Loading branch information
HashEngineering authored Aug 15, 2023
1 parent ef2ec2d commit a86bcc3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/kotlin/org/dashj/platform/dpp/StateRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<ByteArray>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Document(rawDocument: Map<String, Any?>, 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<String, Any?>).containsKey(key)) {
Expand Down
4 changes: 4 additions & 0 deletions src/test/kotlin/org/dashj/platform/dpp/StateRepositoryMock.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit a86bcc3

Please sign in to comment.