Skip to content

Commit

Permalink
Rename all mercury packages
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioPinheiro committed Apr 23, 2024
1 parent 38da3a2 commit bd26e63
Show file tree
Hide file tree
Showing 162 changed files with 1,000 additions and 458 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.iohk.atala.connect.core.model

import io.iohk.atala.connect.core.model.ConnectionRecord.{ProtocolState, Role}
import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import io.iohk.atala.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation

import java.time.Instant
import java.time.temporal.ChronoUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.iohk.atala.connect.core.repository

import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.ConnectionRecord.ProtocolState
import io.iohk.atala.mercury.protocol.connection.*
import org.hyperledger.identus.mercury.protocol.connection.*
import io.iohk.atala.shared.models.WalletAccessContext
import zio.UIO
import zio.URIO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.iohk.atala.connect.core.repository

import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.ConnectionRecord.ProtocolState
import io.iohk.atala.mercury.protocol.connection.ConnectionRequest
import io.iohk.atala.mercury.protocol.connection.ConnectionResponse
import org.hyperledger.identus.mercury.protocol.connection.ConnectionRequest
import org.hyperledger.identus.mercury.protocol.connection.ConnectionResponse
import io.iohk.atala.shared.models.WalletAccessContext
import io.iohk.atala.shared.models.WalletId
import zio.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.iohk.atala.connect.core.service
import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.error.ConnectionServiceError
import io.iohk.atala.connect.core.model.error.ConnectionServiceError.*
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import io.iohk.atala.shared.models.WalletAccessContext
import zio.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import io.iohk.atala.connect.core.model.ConnectionRecord.*
import io.iohk.atala.connect.core.model.error.ConnectionServiceError
import io.iohk.atala.connect.core.model.error.ConnectionServiceError.*
import io.iohk.atala.connect.core.repository.ConnectionRepository
import io.iohk.atala.mercury.*
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.connection.*
import io.iohk.atala.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus.*
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.connection.*
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation
import io.iohk.atala.shared.models.WalletAccessContext
import io.iohk.atala.shared.utils.Base64Utils
import io.iohk.atala.shared.utils.aspects.CustomMetricsAspect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.error.ConnectionServiceError
import io.iohk.atala.connect.core.model.error.ConnectionServiceError.*
import io.iohk.atala.event.notification.{Event, EventNotificationService}
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import io.iohk.atala.shared.models.WalletAccessContext
import zio.{UIO, URIO, URLayer, ZIO, ZLayer}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.iohk.atala.connect.core.service
import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.error.ConnectionServiceError
import io.iohk.atala.connect.core.model.error.ConnectionServiceError.*
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import io.iohk.atala.shared.models.WalletAccessContext
import zio.mock.{Mock, Proxy}
import zio.{UIO, URIO, URLayer, ZIO, ZLayer, mock}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package io.iohk.atala.connect.core.repository

import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.ConnectionRecord.*
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import io.iohk.atala.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation
import io.iohk.atala.shared.models.{WalletAccessContext, WalletId}
import zio.Exit.Failure
import zio.test.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import io.iohk.atala.connect.core.model.ConnectionRecord.*
import io.iohk.atala.connect.core.model.error.ConnectionServiceError
import io.iohk.atala.connect.core.model.error.ConnectionServiceError.InvalidStateForOperation
import io.iohk.atala.connect.core.repository.ConnectionRepositoryInMemory
import io.iohk.atala.mercury.model.{DidId, Message}
import io.iohk.atala.mercury.protocol.connection.ConnectionResponse
import org.hyperledger.identus.mercury.model.{DidId, Message}
import org.hyperledger.identus.mercury.protocol.connection.ConnectionResponse
import io.iohk.atala.shared.models.{WalletAccessContext, WalletId}
import zio.*
import zio.test.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import io.iohk.atala.connect.core.model.ConnectionRecord
import io.iohk.atala.connect.core.model.ConnectionRecord.ProtocolState
import io.iohk.atala.connect.core.repository.ConnectionRepositoryInMemory
import io.iohk.atala.event.notification.*
import io.iohk.atala.mercury.model.DidId
import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import io.iohk.atala.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.connection.{ConnectionRequest, ConnectionResponse}
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation
import io.iohk.atala.shared.models.{WalletAccessContext, WalletId}
import zio.*
import zio.ZIO.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import io.circe.syntax.*
import io.iohk.atala.connect.core.model.*
import io.iohk.atala.connect.core.model.ConnectionRecord.{ProtocolState, Role}
import io.iohk.atala.connect.core.repository.ConnectionRepository
import io.iohk.atala.mercury.protocol.connection.*
import io.iohk.atala.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus.mercury.protocol.connection.*
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation
import io.iohk.atala.shared.db.ContextAwareTask
import io.iohk.atala.shared.db.Implicits.*
import io.iohk.atala.shared.models.WalletAccessContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import zio._

import io.iohk.atala.mercury.model.*
import org.hyperledger.identus.mercury.model.*
import com.nimbusds.jose.jwk.OctetKeyPair
import org.didcommx.peerdid.core.PeerDIDUtils
import org.didcommx.didcomm.common._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import org.didcommx.didcomm.DIDComm

import zio._
import org.didcommx.didcomm.model._

import io.iohk.atala.resolvers._
import io.iohk.atala.mercury.model.{given, _}
import org.hyperledger.identus.resolvers.UniversalDidResolver
import org.hyperledger.identus.mercury.model.{given, _}
import scala.language.implicitConversions

object DidCommX {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import java.util.Base64
import zio._
import io.iohk.atala.resolvers.{AliceSecretResolver, BobSecretResolver, MediatorSecretResolver, UniversalDidResolver}
import io.iohk.atala.mercury.model.Message
import io.iohk.atala.mercury.Agent
import io.iohk.atala.mercury.AgentService
import io.iohk.atala.mercury.protocol.routing._
import io.iohk.atala.mercury.model.Attachment
import io.iohk.atala.mercury.model.EncryptedMessage
import org.hyperledger.identus.mercury.Message
import org.hyperledger.identus.Agent
import org.hyperledger.identus.AgentService
import org.hyperledger.identus.mercury.protocol.routing._
import org.hyperledger.identus.mercury.Attachment
import org.hyperledger.identus.mercury.EncryptedMessage
val program1 = for {
messageCreated <- ZIO.succeed(makeMsg(Agent.Alice, Agent.Bob))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import scala.jdk.CollectionConverters.*
import zio._

import io.circe._
import io.circe.JsonObject
import io.iohk.atala.mercury.model._
import io.iohk.atala.mercury.model.error._
import io.iohk.atala.mercury.protocol.routing._
import io.iohk.atala.resolvers.DIDResolver
import org.hyperledger.identus.mercury.model._
import org.hyperledger.identus.mercury.error._
import org.hyperledger.identus.mercury.protocol.routing._
import org.hyperledger.identus.resolvers.DIDResolver

type HttpOrDID = String //TODO
case class ServiceEndpoint(uri: HttpOrDID, accept: Option[Seq[String]], routingKeys: Option[Seq[String]])
Expand Down Expand Up @@ -124,7 +124,7 @@ object MessagingService {
didCommService.packEncrypted(msg = finalMessage, to = finalMessage.to.head) // TODO Head

_ <- ZIO.log(s"Sending a Message to '$serviceEndpoint'")
resp <- HttpClient
resp <- org.hyperledger.identus.mercury.HttpClient
.postDIDComm(url = serviceEndpoint, data = encryptedMessage.string)
.catchAll { case ex => ZIO.fail(SendMessageError(ex, Some(encryptedMessage.string))) }
_ <- ZIO.when(resp.status >= 300)(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import org.didcommx.peerdid.*

Expand All @@ -9,7 +9,7 @@ import io.circe.syntax._
import io.circe.generic.semiauto._
import scala.jdk.CollectionConverters.*

import io.iohk.atala.mercury.model.DidId
import org.hyperledger.identus.mercury.model.DidId

final case class PeerDID(
did: DidId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.iohk.atala.mercury.model
package org.hyperledger.identus.mercury.model

import io.circe.*
import io.iohk.atala.mercury.model.*
import org.hyperledger.identus.mercury.model.*
import org.didcommx.didcomm.message.Attachment.Data
import org.didcommx.didcomm.message.{MessageBuilder, Attachment as XAttachment}
import org.didcommx.didcomm.model.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.mercury.model
package org.hyperledger.identus.mercury.model

import scala.jdk.CollectionConverters._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.mercury.model
package org.hyperledger.identus.mercury.model

import scala.jdk.CollectionConverters.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.resolvers
package org.hyperledger.identus.mercury.resolvers

import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType}
import org.didcommx.didcomm.secret.{Secret, SecretResolverInMemory}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.resolvers
package org.hyperledger.identus.mercury.resolvers

import org.didcommx.didcomm.common.{VerificationMaterial, VerificationMaterialFormat, VerificationMethodType}
import org.didcommx.didcomm.secret.{Secret, SecretResolverInMemory}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ import org.didcommx.peerdid._
object CharlieSecretResolver {
private val jwkKey1 =
// "kid":"${io.iohk.atala.mercury.charlie}#6LSiseNCbbtmG6ascxpPvoyT8ewrWdtJZxwmPNxYAPWxzM8",
// "kid":"${org.hyperledger.identus.charlie}#6LSiseNCbbtmG6ascxpPvoyT8ewrWdtJZxwmPNxYAPWxzM8",
s"""{"kty":"OKP","d":"r-jK2cO3taR8LQnJB1_ikLBTAnOtShJOsHXRUWT-aZA","crv":"X25519","x":"avH0O2Y4tqLAq8y9zpianr8ajii5m4F_mICrzNlatXs"}"""
private val jwkKey2 = // example from did:example:alice#key-1
// "kid":"${io.iohk.atala.mercury.charlie}#6MkgLBGee6xL5KH8SZmqmKmQKS2o1qd4RG4dSmjtRGTfsxX",
// "kid":"${org.hyperledger.identus.charlie}#6MkgLBGee6xL5KH8SZmqmKmQKS2o1qd4RG4dSmjtRGTfsxX",
s"""{"kty":"OKP","d":"pFRUKkyzx4kHdJtFSnlPA9WzqkDT1HWV0xZ5OYZd2SY","crv":"Ed25519","x":"G-boxFB6vOZBu-wXkm-9Lh79I8nf9Z50cILaOgKKGww"}"""
private val secretKey1 = new Secret(
io.iohk.atala.mercury.charlie + "#6LSiseNCbbtmG6ascxpPvoyT8ewrWdtJZxwmPNxYAPWxzM8",
org.hyperledger.identus.charlie + "#6LSiseNCbbtmG6ascxpPvoyT8ewrWdtJZxwmPNxYAPWxzM8",
VerificationMethodType.JSON_WEB_KEY_2020,
new VerificationMaterial(VerificationMaterialFormat.JWK, jwkKey1)
)
private val secretKeyAgreement1 = new Secret(
io.iohk.atala.mercury.charlie + "#6MkgLBGee6xL5KH8SZmqmKmQKS2o1qd4RG4dSmjtRGTfsxX",
org.hyperledger.identus.charlie + "#6MkgLBGee6xL5KH8SZmqmKmQKS2o1qd4RG4dSmjtRGTfsxX",
VerificationMethodType.JSON_WEB_KEY_2020,
new VerificationMaterial(VerificationMaterialFormat.JWK, jwkKey2)
)
val secretResolver = new SecretResolverInMemory(
Map(
(io.iohk.atala.mercury.charlie + "#6LSiseNCbbtmG6ascxpPvoyT8ewrWdtJZxwmPNxYAPWxzM8") -> secretKey1,
(io.iohk.atala.mercury.charlie + "#6MkgLBGee6xL5KH8SZmqmKmQKS2o1qd4RG4dSmjtRGTfsxX") -> secretKeyAgreement1,
(io.iohk.atala.mercury.charlie) -> secretKeyAgreement1
(org.hyperledger.identus.charlie + "#6LSiseNCbbtmG6ascxpPvoyT8ewrWdtJZxwmPNxYAPWxzM8") -> secretKey1,
(org.hyperledger.identus.charlie + "#6MkgLBGee6xL5KH8SZmqmKmQKS2o1qd4RG4dSmjtRGTfsxX") -> secretKeyAgreement1,
(org.hyperledger.identus.charlie) -> secretKeyAgreement1
).asJava
)
Expand All @@ -52,7 +52,7 @@ object CharlieSecretResolver {
println(
org.didcommx.peerdid.PeerDIDResolver
.resolvePeerDID(
io.iohk.atala.mercury.charlie,
org.hyperledger.identus.charlie,
VerificationMaterialFormatPeerDID.JWK
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import munit.*
import io.iohk.atala.mercury.model.DidId
import org.hyperledger.identus.mercury.model.DidId
import com.nimbusds.jose.jwk.OctetKeyPair
import org.hyperledger.identus.mercury.PeerDID

class PeerDIDSpec extends ZSuite {

test("Make and parse PeerDID") {
val peer = PeerDID.makePeerDid(serviceEndpoint = Some("http://localhost:8654/myendpoint"))
val peer =
org.hyperledger.identus.mercury.PeerDID.makePeerDid(serviceEndpoint = Some("http://localhost:8654/myendpoint"))

val did = peer.did.value
// Exemple {"kty":"OKP","d":"XwaryH2em2iRwqPjxInIHrhvKJqLZ_iejheA5cVM2ZY","crv":"X25519","x":"w1tZHpAuQ6TD6q5cMGWu6q2K1eL3gvEbE1gwkMzLnQI"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package io.iohk.atala.mercury.model
package org.hyperledger.identus.mercury.model

import munit.*
import io.circe.JsonObject
import scala.language.implicitConversions
import org.hyperledger.identus.mercury.model.UnpackMessageImp

/** agentDidcommx/testOnly io.iohk.atala.mercury.model.UnpackMessageImpSpec */
/** agentDidcommx/testOnly org.hyperledger.identus.mercury.UnpackMessageImpSpec */
class UnpackMessageImpSpec extends ZSuite {
test("Message conversions - check pleaseAck None") {
val m1 = Message(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import io.iohk.atala.mercury.model.DidId
import org.hyperledger.identus.mercury.model.DidId

enum Agent(val id: DidId):
case Alice extends Agent(DidId("did:example:alice"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package io.iohk.atala
/*
package org.hyperledger.identus.mercury
import zio._
import io.circe._
import io.circe.Json._
import io.circe.parser._
import io.circe.JsonObject
import io.iohk.atala.mercury.*
import io.iohk.atala.mercury.model._
import io.iohk.atala.mercury.protocol.mailbox.Mailbox.ReadMessage
import io.iohk.atala.mercury.protocol.routing._
import org.hyperledger.identus.*
import org.hyperledger.identus.mercury.model._
import org.hyperledger.identus.mercury.protocol.routing._
import org.hyperledger.identus.mercury.{Agent, HttpClient}
def makeMsg(from: Agent, to: Agent) = Message(
`type` = "http://atalaprism.io/lets_connect/proposal",
Expand Down Expand Up @@ -104,3 +105,4 @@ object AgentPrograms {
} yield ()
}
*/
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import scala.util.chaining._
import zio._
import io.circe.parser._
import io.circe.JsonObject

import io.iohk.atala.mercury._
import io.iohk.atala.mercury.model._
import io.iohk.atala.mercury.protocol.coordinatemediation._
import io.iohk.atala.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus._
import org.hyperledger.identus.mercury.model._
import org.hyperledger.identus.mercury.protocol.coordinatemediation._
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation

object CoordinateMediationPrograms {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.mercury
package org.hyperledger.identus.mercury

import zio._

Expand Down
Loading

0 comments on commit bd26e63

Please sign in to comment.