diff --git a/did/shared/src/main/scala/fmgp/did/VerificationMethod.scala b/did/shared/src/main/scala/fmgp/did/VerificationMethod.scala index 830ee560..db1bf627 100644 --- a/did/shared/src/main/scala/fmgp/did/VerificationMethod.scala +++ b/did/shared/src/main/scala/fmgp/did/VerificationMethod.scala @@ -50,6 +50,7 @@ case class VerificationMethodReferenced(value: String) extends VerificationMetho def did = DIDSubject(value.split('#').head) def fromto = FROMTO(value.split('#').head) // FIXME def id = value // TODO rename value to id + def fragment = value.split("#", 2).drop(1).head // TODO make it type safe } object VerificationMethodReferenced { given decoder: JsonDecoder[VerificationMethodReferenced] = JsonDecoder.string.map(VerificationMethodReferenced.apply) diff --git a/webapp/src/main/scala/fmgp/webapp/DecryptTool.scala b/webapp/src/main/scala/fmgp/webapp/DecryptTool.scala index add72510..d9827a76 100644 --- a/webapp/src/main/scala/fmgp/webapp/DecryptTool.scala +++ b/webapp/src/main/scala/fmgp/webapp/DecryptTool.scala @@ -92,16 +92,36 @@ object DecryptTool { div( children <-- encryptedMessageVar.map { mMsg => mMsg.toSeq - .map(_.`protected`.obj.toJsonPretty) - .map(p(_)) + .flatMap { + _.`protected`.obj match + case header @ AnonProtectedHeader(epk, apv, typ, enc, alg) => + Seq( + p("Anoncrypt:"), + pre(code(header.toJsonPretty)), + ) + case header @ AuthProtectedHeader(epk, apv, skid, apu, typ, enc, alg) => + Seq( + p( + "Authcrypt from: ", + code( + a(skid.did.string, MyRouter.navigateTo(MyRouter.ResolverPage(skid.did.string))), + "#", + skid.fragment + ) + ), + pre(code(header.toJsonPretty)) + ) + } }, ), - p("Recipients:"), - div( + p("Recipients kid:"), + ul( children <-- encryptedMessageVar.map { mMsg => mMsg.toSeq - .flatMap(_.recipients.toSeq.map(_.header.kid.value)) - .map(e => p(s" - kid: $e")) + .flatMap(_.recipients.toSeq.map(_.header.kid)) + .map(kid => + li(code(a(kid.did.string, MyRouter.navigateTo(MyRouter.ResolverPage(kid.did.string))), "#", kid.fragment)) + ) }, ), p("Raw Data (as UTF8) after decrypting:"), diff --git a/webapp/src/main/scala/fmgp/webapp/EncryptTool.scala b/webapp/src/main/scala/fmgp/webapp/EncryptTool.scala index 1dd72519..c2b687a2 100644 --- a/webapp/src/main/scala/fmgp/webapp/EncryptTool.scala +++ b/webapp/src/main/scala/fmgp/webapp/EncryptTool.scala @@ -283,6 +283,14 @@ object EncryptTool { { import MessageTemplate.Pickup3._ li( + button( + "Status", + onClick --> Observer(_ => dataTextVar.set(exStatus.toPlaintextMessage.toJsonPretty)) + ), + button( + "StatusRequest", + onClick --> Observer(_ => dataTextVar.set(exStatusRequest.toPlaintextMessage.toJsonPretty)) + ), button( "DeliveryRequest", onClick --> Observer(_ => dataTextVar.set(exDeliveryRequest.toPlaintextMessage.toJsonPretty)) @@ -295,14 +303,6 @@ object EncryptTool { "MessagesReceived", onClick --> Observer(_ => dataTextVar.set(exMessagesReceived.toPlaintextMessage.toJsonPretty)) ), - button( - "Status", - onClick --> Observer(_ => dataTextVar.set(exStatus.toPlaintextMessage.toJsonPretty)) - ), - button( - "StatusRequest", - onClick --> Observer(_ => dataTextVar.set(exStatusRequest.toPlaintextMessage.toJsonPretty)) - ), button( "LiveModeChange", onClick --> Observer(_ => dataTextVar.set(exLiveModeChange.toPlaintextMessage.toJsonPretty))