Skip to content

Commit

Permalink
fix: fix Json serialisation error when packing forward message for me…
Browse files Browse the repository at this point in the history
…diator

Signed-off-by: Benjamin Voiturier <[email protected]>
  • Loading branch information
bvoiturier committed Dec 4, 2024
1 parent 09767ce commit e2a9919
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package org.hyperledger.identus.mercury.model

import zio.json.ast.Json
import zio.json.EncoderOps
import zio.json.DecoderOps

import java.util.Base64

trait EncryptedMessage { // (private val msg: PackEncryptedResult) {
def string: String // = msg.getPackedMessage
def base64: String = Base64.getUrlEncoder.encodeToString(string.getBytes)
def asJson: Json.Obj = {
string.toJsonAST
string
.fromJson[Json]
.flatMap(o =>
o.asObject match
case None => Left(RuntimeException(s"Expecting Json Object got '$o'"))
Expand Down

0 comments on commit e2a9919

Please sign in to comment.