Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/return_202_HT…
Browse files Browse the repository at this point in the history
…TP_code
  • Loading branch information
FabioPinheiro committed Nov 7, 2023
2 parents 99e08dc + d08a8a6 commit 92a6179
Show file tree
Hide file tree
Showing 31 changed files with 527 additions and 253 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Scala Steward: Reformat with scalafmt 3.7.8
7f0ad6980840682687eb6bc0017014e08ae46421

# Scala Steward: Reformat with scalafmt 3.7.15
3e95a584d68fdb4506caa91a0c7833d277dc8c8d
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.embedmongo
key: ${{ runner.os }}-embedmongo-4.9.2
key: ${{ runner.os }}-embedmongo-4.9.3
restore-keys: |
${{ runner.os }}-embedmongo-4.9.2
${{ runner.os }}-embedmongo-4.9.3
### Compile and TESTS ###
- run: sbt -mem 2048 -J-Xmx5120m "test"
env:
Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.7.14"
version = "3.7.15"
runner.dialect = scala3

maxColumn = 120
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [0.10.2](https://github.com/input-output-hk/atala-prism-mediator/compare/prism-mediator-v0.10.1...prism-mediator-v0.10.2) (2023-11-06)


### Bug Fixes

* Send problemReport for duplicate message ([#157](https://github.com/input-output-hk/atala-prism-mediator/issues/157)) ([df522cf](https://github.com/input-output-hk/atala-prism-mediator/commit/df522cf57e550827dbfa3bff665c00b63051018e))

## [0.10.1](https://github.com/input-output-hk/atala-prism-mediator/compare/prism-mediator-v0.10.0...prism-mediator-v0.10.1) (2023-10-13)


Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ lazy val V = new {
val zio = "2.0.18"
val zioJson = "0.6.2"
// val zioMunitTest = "0.1.1"
val zioHttp = "3.0.0-RC2"
val zioHttp = "3.0.0-RC3"
val zioConfig = "4.0.0-RC16"
val zioLogging = "2.1.14"
val zioSl4j = "2.1.14"
val logback = "1.3.11"
val logstash = "7.4"
val jansi = "2.4.1"
val mongo = "1.1.0-RC10"
val embedMongo = "4.9.2"
val embedMongo = "4.9.3"
val munitZio = "0.1.1"
val zioTest = "2.0.18"
val zioTestSbt = "2.0.18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ class MessageDispatcherJVM(client: Client) extends MessageDispatcher {
.pipe(e => Header.ContentType(ZMediaType.application.any.copy(subType = "didcomm-encrypted+json")))
val xForwardedHostHeader = xForwardedHost.map(x => Header.Custom(customName = MyHeaders.xForwardedHost, x))

// xForwardedHost.map(x => Header.(MyHeaders.xForwardedHost, x))
for {
res <- Client
.request(
url = destination,
method = Method.POST,
headers = Headers(Seq(Some(contentTypeHeader), xForwardedHostHeader).flatten),
content = Body.fromCharSequence(msg.toJson),
Request
.post(destination, Body.fromCharSequence(msg.toJson))
.setHeaders(Headers(Seq(Some(contentTypeHeader), xForwardedHostHeader).flatten))
)
.tapError(ex => ZIO.logWarning(s"Fail when calling '$destination': ${ex.toString}"))
.mapError(ex => DispatcherError(ex))
Expand All @@ -51,5 +49,7 @@ class MessageDispatcherJVM(client: Client) extends MessageDispatcher {
case true => ZIO.logWarning(data)
case false => ZIO.logInfo(data)
} yield (data)
}.provideEnvironment(ZEnvironment(client))
}
.provideSomeLayer(Scope.default)
.provideEnvironment(ZEnvironment(client))
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
package io.iohk.atala.mediator.utils
import zio.*
Expand Down Expand Up @@ -50,3 +51,4 @@ object MiddlewareUtils {
}
}
*/
2 changes: 1 addition & 1 deletion infrastructure/charts/mediator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.10.1"
appVersion: "0.10.2"
dependencies: []
6 changes: 6 additions & 0 deletions mediator/src/main/scala/io/iohk/atala/mediator/Error.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ object StorageThrowable {
def apply(throwable: Throwable) = new StorageThrowable(throwable.getClass.getName() + ":" + throwable.getMessage)
}

final case class DuplicateMessage(val error: String) extends StorageError
object DuplicateMessage {
val code = 11000
def apply(throwable: Throwable) = new DuplicateMessage(throwable.getClass.getName() + ":" + throwable.getMessage)
}

// ProtocolError
sealed trait ProtocolError extends MediatorError {
def piuri: PIURI
Expand Down
57 changes: 32 additions & 25 deletions mediator/src/main/scala/io/iohk/atala/mediator/app/IndexHtml.scala
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
package io.iohk.atala.mediator.app

import zio.http.Response
import zio.http._
import fmgp.did.DID

object IndexHtml {
// TODO use the html.Html.fromDomElement()
def html(identity: DID) = Response.html(s"""<html>
|<head>
| <meta charset="UTF-8">
| <title>IOHK Mediator</title>
| <meta name="viewport" content="width=device-width, initial-scale=1.0">
| <meta name="did" content="${identity.did}">
| <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
| <link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
| <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
| <script>
| var callback = function () {
| alert('A callback was triggered');
| }
| </script>
| <!-- My APP -->
| <script type="text/javascript" src="public/webapp-fastopt-bundle.js"></script>
|</head>
|
|<body style="margin:0;">
| <div id="app-container"></div>
|</body>
|
|</html>""".stripMargin)
def html(identity: DID) =
Response(
status = Status.Ok,
headers = Headers(Header.ContentType(MediaType.text.html).untyped),
body = Body.fromString(
s"""<!DOCTYPE html>
|<html>
|<head>
| <meta charset="UTF-8">
| <title>IOHK Mediator</title>
| <meta name="viewport" content="width=device-width, initial-scale=1.0">
| <meta name="did" content="${identity.did}">
| <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
| <link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
| <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
| <script>
| var callback = function () {
| alert('A callback was triggered');
| }
| </script>
| <!-- My APP -->
| <script type="text/javascript" src="public/webapp-fastopt-bundle.js"></script>
|</head>
|
|<body style="margin:0;">
| <div id="app-container"></div>
|</body>
|
|</html>""".stripMargin
),
)
}
Loading

0 comments on commit 92a6179

Please sign in to comment.