Skip to content

Commit

Permalink
Minor improvements on the test-interoperability.md
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioPinheiro committed Aug 18, 2023
1 parent 6f78639 commit 6b6dcb4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 26 additions & 6 deletions webapp/src/main/scala/fmgp/webapp/DecryptTool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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:"),
Expand Down
16 changes: 8 additions & 8 deletions webapp/src/main/scala/fmgp/webapp/EncryptTool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit 6b6dcb4

Please sign in to comment.