Skip to content

Commit

Permalink
Fix issue with seed conversion in publish method
Browse files Browse the repository at this point in the history
- Use ByteOps to convert the seed string to ByteArray
- Ident method with Ktlint
  • Loading branch information
rogelio-blanco committed Aug 27, 2022
1 parent 387b88b commit 624cf62
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class WalletService(private val walletStorage: WalletStorage, private val dlt: D
}

fun findDid(walletId: String, didAlias: String): Did {
return walletStorage.findDidByAlias(walletId, didAlias).orElseThrow{ Exception("Unable to find DID alias.") }
return walletStorage.findDidByAlias(walletId, didAlias).orElseThrow { Exception("Unable to find DID alias.") }
}

fun didAliasExists(walletId: String, didAlias: String): Boolean {
Expand All @@ -112,7 +112,7 @@ class WalletService(private val walletStorage: WalletStorage, private val dlt: D
.let { w ->
w.dids.firstOrNull { it.alias.equals(didAlias, true) }
?.let { d ->
val dltDidUpdate = dlt.publishDid(d, w.seed.toByteArray())
val dltDidUpdate = dlt.publishDid(d, BytesOps.hexToBytes(w.seed))

d.publishedStatus = AtalaOperationStatus.PENDING_SUBMISSION
d.publishedOperationId = dltDidUpdate.operationId ?: throw Exception("Unable to find operation id.")
Expand All @@ -123,7 +123,7 @@ class WalletService(private val walletStorage: WalletStorage, private val dlt: D

return d
}
?: throw Exception("Did alias '$didAlias' not found")
?: throw Exception("Did alias '$didAlias' not found")
}
}

Expand All @@ -146,6 +146,6 @@ class WalletService(private val walletStorage: WalletStorage, private val dlt: D
val publishOperationInfo = dlt.getDidPublishOperationInfo(d)
d.publishedStatus = publishOperationInfo
return publishOperationInfo
} ?: throw Exception("Did alias '$didAlias' not found")
} ?: throw Exception("Did alias '$didAlias' not found")
}
}

0 comments on commit 624cf62

Please sign in to comment.