Skip to content

Commit

Permalink
Add a getDidDocument function that returns json (#13)
Browse files Browse the repository at this point in the history
Add a getDidDocument function that returns json instead of PrismDidDataModel
  • Loading branch information
Essbante authored May 7, 2022
1 parent c9f9cf1 commit 8417ed9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/kotlin/com/rootsid/wal/library/DLT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import kotlinx.serialization.decodeFromString
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import pbandk.ByteArr
import pbandk.json.encodeToJsonString

/**
* Transaction id
Expand Down Expand Up @@ -225,6 +226,11 @@ fun getDidDocument(wallet: Wallet, didAlias: String): PrismDidState {
}
}

@OptIn(PrismSdkInternal::class)
fun getDidDocumentJson(wallet: Wallet, didAlias: String): String {
return getDidDocument(wallet, didAlias).didData.toProto().encodeToJsonString()
}

/**
* Publish did
*
Expand Down Expand Up @@ -571,7 +577,7 @@ fun verifyIssuedCredential(wallet: Wallet, credentialAlias: String): List<String

private fun VerificationResult.toMessageArray(): List<String> {
val messages = mutableListOf<String>()
for(message in this.verificationErrors) {
for (message in this.verificationErrors) {
messages.add(message.errorMessage)
}
return messages
Expand Down

0 comments on commit 8417ed9

Please sign in to comment.