Skip to content

Commit

Permalink
feat: mediator rename package and organise the packages (#12)
Browse files Browse the repository at this point in the history
* feat: mediator rename package and code cleanup

Signed-off-by: Shailesh Patil <53746241+mineme0110@users.noreply.github.com>

Signed-off-by: Shailesh Patil <shailesh.patil@iohk.io>
  • Loading branch information
mineme0110 committed May 1, 2024
1 parent ebf4597 commit 594081c
Show file tree
Hide file tree
Showing 25 changed files with 181 additions and 238 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ lazy val httpUtils = crossProject(JSPlatform, JVMPlatform) // project
)

lazy val mediator = project
.in(file("did-mediator"))
.in(file("mediator"))
.settings(publish / skip := true)
.settings((setupTestConfig): _*)
.settings(
Expand All @@ -165,7 +165,7 @@ lazy val mediator = project
libraryDependencies += D.mongo.value,
)
.settings(
Compile / mainClass := Some("fmgp.did.demo.MediatorStandalone"),
Compile / mainClass := Some("io.iohk.atala.mediator.app.MediatorStandalone"),
Docker / maintainer := "atala-coredid@iohk.io",
Docker / dockerUsername := Some("input-output-hk"),
Docker / dockerRepository := Some("ghcr.io"),
Expand Down
59 changes: 0 additions & 59 deletions did-mediator/src/main/scala/fmgp/did/MongoDriver.scala

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package fmgp.did.comm
package io.iohk.atala.mediator.comm

import zio._
import zio.json._
import zio.http._
import zio.http.model._

import fmgp.did._
import fmgp.did.comm._
import fmgp.crypto.error._
import fmgp.util.MyHeaders
import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import io.iohk.atala.mediator.comm.*
import io.iohk.atala.mediator.utils.MyHeaders
import zio.*
import zio.http.*
import zio.http.model.*
import zio.json.*

object MessageDispatcherJVM {
val layer: ZLayer[Client, Throwable, MessageDispatcher] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package fmgp.util
package io.iohk.atala.mediator.utils

import zio._
import zio.json._
import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import zio.*
import zio.http.socket.*
import zio.http.{Channel, ChannelEvent}
import zio.http.socket._
import zio.stream._

import fmgp.did._
import fmgp.did.comm._
import fmgp.crypto.error._
import zio.json.*
import zio.stream.*

case class DIDSocketManager(
sockets: Map[SocketID, MyChannel] = Map.empty,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fmgp.util
package io.iohk.atala.mediator.utils

import zio._
import zio.http._
import zio.*
import zio.http.*

extension [R, Err](app: HttpApp[R, Err])
def annotateLogs: HttpApp[R, Err] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package fmgp.util
package io.iohk.atala.mediator.utils

import zio._
import zio.*

type SocketID = String
case class MyChannel(id: SocketID, socketOutHub: Hub[String])
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package fmgp.did.comm
package io.iohk.atala.mediator.comm

import zio._
import zio.json._

import fmgp.did._
import fmgp.did.comm._
import fmgp.crypto.error._
import fmgp.util.MyHeaders
import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import io.iohk.atala.mediator.utils.MyHeaders
import zio.*
import zio.json.*

trait MessageDispatcher {
def send(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fmgp.did.comm

import zio.json._
package io.iohk.atala.mediator.comm

import zio.json.*
import fmgp.did.comm.*
final case class TapMessage(msg: EncryptedMessage, decrypted: PlaintextMessage)

object TapMessage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fmgp.util
package io.iohk.atala.mediator.utils

object MyHeaders {
final val xForwardedHost: CharSequence = "x-forwarded-host"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package fmgp.did
package io.iohk.atala.mediator

import fmgp.crypto.error._
import fmgp.did._
import fmgp.did.comm._
import zio.json._
import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import zio.json.*

trait MediatorError

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fmgp.did.comm.protocol
package io.iohk.atala.mediator.actions

import fmgp.did.comm.PlaintextMessage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package fmgp.did.comm.protocol

import zio._
import zio.json._

import fmgp.crypto.error._
import fmgp.did._
import fmgp.did.comm._
import fmgp.did.comm.Operations._
import fmgp.did.comm.protocol._
import fmgp.did.comm.protocol.basicmessage2._
import fmgp.did.comm.protocol.trustping2._
import fmgp.did.db._

package io.iohk.atala.mediator.actions

import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import fmgp.did.comm.Operations.*
import fmgp.did.comm.protocol.*
import fmgp.did.comm.protocol.basicmessage2.*
import fmgp.did.comm.protocol.trustping2.*
import io.iohk.atala.mediator.*
import io.iohk.atala.mediator.comm.*
import io.iohk.atala.mediator.db.*
import zio.*
import zio.json.*
//TODO pick a better name // maybe "Protocol" only

trait ProtocolExecuter[-R] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package fmgp.did.comm.mediator

import zio._
import zio.json._
import zio.http._
import zio.http.model._
import zio.http.socket._
import zio.http.socket.SocketApp
package io.iohk.atala.mediator.app

import fmgp.crypto.*
import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import fmgp.did.comm.protocol.*
import io.iohk.atala.mediator.*
import io.iohk.atala.mediator.actions.*
import io.iohk.atala.mediator.comm.*
import io.iohk.atala.mediator.db.*
import io.iohk.atala.mediator.protocols.*
import io.iohk.atala.mediator.utils.*
import io.netty.handler.codec.http.HttpHeaderNames
import reactivemongo.api.bson.Macros.{*, given}
import reactivemongo.api.bson.{*, given}
import zio.*
import zio.http.*
import zio.http.model.*
import zio.http.socket.*
import zio.json.*

import fmgp.util._
import fmgp.did._
import fmgp.crypto._
import fmgp.crypto.error._
import fmgp.did.comm._
import fmgp.did.comm.protocol._
import fmgp.did.db._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.Try

import reactivemongo.api.bson.{_, given}
import reactivemongo.api.bson.Macros.{_, given}

case class MediatorAgent(
override val id: DID,
override val keyStore: KeyStore, // Should we make it lazy with ZIO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
package fmgp.did.demo
package io.iohk.atala.mediator.app

import zio._
import zio.json._
import zio.stream._
import zio.http._
import zio.http.model._
import zio.http.socket._
import fmgp.crypto.*
import fmgp.crypto.error.*
import fmgp.did.*
import fmgp.did.comm.*
import fmgp.did.comm.protocol.*
import fmgp.did.method.peer.*
import io.iohk.atala.mediator.actions.*
import io.iohk.atala.mediator.comm.*
import io.iohk.atala.mediator.db.*
import io.iohk.atala.mediator.protocols.*
import io.iohk.atala.mediator.utils.*
import zio.*
import zio.config.*
import zio.config.magnolia.*
import zio.config.typesafe.*
import zio.http.*
import zio.http.Http.{Empty, Static}
import zio.http.ZClient.ClientLive
import zio.http.Http.Empty
import zio.http.Http.Static
import zio.config._
import zio.config.magnolia._
import zio.config.typesafe._
import zio.http.model.*
import zio.http.socket.*
import zio.json.*
import zio.stream.*

import scala.io.Source

import fmgp.crypto._
import fmgp.crypto.error._
import fmgp.util._
import fmgp.did._
import fmgp.did.comm._
import fmgp.did.comm.mediator._
import fmgp.did.comm.protocol._
import fmgp.did.method.peer._
import fmgp.did.db._

case class MediatorConfig(endpoint: java.net.URI, keyAgreement: OKPPrivateKey, keyAuthentication: OKPPrivateKey) {
val did = DIDPeer2.makeAgent(
Seq(keyAgreement, keyAuthentication),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package fmgp.did.db
package io.iohk.atala.mediator.db

import zio.{TaskLayer, ZIO, ZLayer}
import scala.concurrent.duration.DurationInt
import reactivemongo.api.{AsyncDriver, DB, MongoConnection}
import zio.{Task, ZIO, ZLayer}
import zio.{Task, TaskLayer, ZIO, ZLayer}

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.DurationInt

object AsyncDriverResource {
private def acquire = ZIO.attempt(AsyncDriver())
Expand Down
Loading

0 comments on commit 594081c

Please sign in to comment.