Skip to content

Commit

Permalink
feat: Update ScalaDID to 0.1.0-M18 and support new format of DID Peer (
Browse files Browse the repository at this point in the history
…#204)

Fix #158 (support for the new format of DID Peer)
Update scala-did to 0.1.0-M17
Update scala-did to 0.1.0-M18
Test the Integration Test

Signed-off-by: Fabio Pinheiro <fabiomgpinheiro@gmail.com>

Signed-off-by: Shailesh Patil <shailesh.patil@iohk.io>
  • Loading branch information
FabioPinheiro authored and mineme0110 committed May 1, 2024
1 parent 7010e86 commit 640546d
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
ATALA_GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
REPORTS_DIR: "didcomm-v2-mediator-test-suite/target/site/serenity"
DIDCOMM_V2_TESTSUITE_VERSION: "13882b256bfdbe8ba738c2798dffc0ce25ca52e4"
MEDIATOR_DID: "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ.SeyJ0IjoiZG0iLCJzIjoid3M6Ly9sb2NhbGhvc3Q6ODA4MC93cyIsInIiOltdLCJhIjpbImRpZGNvbW0vdjIiXX0"
DIDCOMM_V2_TESTSUITE_VERSION: "58e0f9684b5bc001703bb9a7972793978659809a"
MEDIATOR_DID: "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImEiOlsiZGlkY29tbS92MiJdfX0.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6IndzOi8vbG9jYWxob3N0OjgwODAvd3MiLCJhIjpbImRpZGNvbW0vdjIiXX19"
steps:
- name: Checkout mediator
uses: actions/checkout@v3
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ By default mediator will start on port 8080
You can open the `http://localhost:8080/` URL in a web browser, and it will show a QR code that serves as an out-of-band invitation for the Mediator.

## How to run mediator as docker image

### Docker only

It is possible to run everything with a single command with Docker compose docker-compose.yml
The latest stable image version is available in the IOHK repositories.
To build a docker image locally, run NODE_OPTIONS=--openssl-legacy-provider sbt docker:publishLocal.
```
To build a docker image locally, run `NODE_OPTIONS=--openssl-legacy-provider sbt docker:publishLocal`.

```shell
shell> cd atala-prism-mediator
shell> NODE_OPTIONS=--openssl-legacy-provider sbt docker:publishLocal
shell> MEDIATOR_VERSION=$(sbt "print mediator/version" --error) docker compose up
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inThisBuild(

/** Versions */
lazy val V = new {
val scalaDID = "0.1.0-M16"
val scalaDID = "0.1.0-M18"

// FIXME another bug in the test framework https://github.com/scalameta/munit/issues/554
val munit = "1.0.0-M11" // "0.7.29"
Expand Down
2 changes: 1 addition & 1 deletion make-trust-ping-example-kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Using Docker

```shell
docker:publishLocal # Compile and create the mediator image
docker compose up #docker run -p 8080:8080 ghcr.io/input-output-hk/mediator:0.1.0-SNAPSHOT
docker-compose up #docker run -p 8080:8080 ghcr.io/input-output-hk/atala-prism-mediator:0.1.0-SNAPSHOT
```


Expand Down
2 changes: 1 addition & 1 deletion make-trust-ping-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

```shell
docker:publishLocal # Compile and create the mediator image
docker compose up #docker run -p 8080:8080 ghcr.io/input-output-hk/mediator:0.1.0-SNAPSHOT
docker-compose up #docker run -p 8080:8080 ghcr.io/input-output-hk/atala-prism-mediator:0.1.0-SNAPSHOT
```

## Run the client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ import scala.io.Source
case class MediatorConfig(endpoints: String, keyAgreement: OKPPrivateKey, keyAuthentication: OKPPrivateKey) {
val did = DIDPeer2.makeAgent(
Seq(keyAgreement, keyAuthentication),
endpoints.split(";").toSeq.map(e => DIDPeerServiceEncoded(s = e.toString))
endpoints
.split(";")
.toSeq
.map { endpoint => fmgp.util.Base64.encode(s"""{"t":"dm","s":{"uri":"$endpoint","a":["didcomm/v2"]}}""") }
.map(DIDPeerServiceEncodedNew(_))
)
val agentLayer: ZLayer[Any, Nothing, MediatorAgent] =
ZLayer(MediatorAgent.make(id = did.id, keyStore = did.keyStore))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,50 @@ import fmgp.did.method.peer.{DIDPeer2, DIDPeerServiceEncoded}
//import io.iohk.atala.mediator.db.AgentStub.{keyAgreement, keyAuthentication}
import zio.json.*
trait DidAccountStubSetup {

/** alice localhost 8080 (http + ws) in the new did peer format */
val alice =
DIDSubject(
"did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ"
"did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImEiOlsiZGlkY29tbS92MiJdfX0"
)

/** bob (https://bob.did.fmgp.app/) in the new did peer format */
val bob =
DIDSubject(
"did:peer:2.Ez6LSkGy3e2z54uP4U9HyXJXRpaF2ytsnTuVgh6SNNmCyGZQZ.Vz6Mkjdwvf9hWc6ibZndW9B97si92DSk9hWAhGYBgP9kUFk8Z.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9ib2IuZGlkLmZtZ3AuYXBwLyIsInIiOltdLCJhIjpbImRpZGNvbW0vdjIiXX0"
"did:peer:2.Ez6LSkGy3e2z54uP4U9HyXJXRpaF2ytsnTuVgh6SNNmCyGZQZ.Vz6Mkjdwvf9hWc6ibZndW9B97si92DSk9hWAhGYBgP9kUFk8Z.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHBzOi8vYm9iLmRpZC5mbWdwLmFwcC8iLCJhIjpbImRpZGNvbW0vdjIiXX19"
)

/** trust-ping from Alice to Bob */
val encryptedMessageAlice: Either[String, EncryptedMessage] =
"""{
| "ciphertext": "L8wzawffzL7kbVyDcMiHgQMwlqLUqWDYOwH4f0VOFK7sJL8vO-H_JBDCADu7gvH1MDHdVJDXQmSv5dDXp6JYubagcSfBqyZGKGOQDQz-1Ir6-sqZ9K5xRPMt76dYbSswrxhaROVJvtAXyrTmN3KEv8SgP_vt8za5QU6B8cM6gp2CycJKoIhETnhVEVjHnrX0YcyzBsLhd-ZKb8e1Nlz_XSh-3cw1oIQMFjXHnU3PSjrqXcrC-4qSGpVVpHvMSOF3o2EbLGEpP-8UbI0psgSLd9a2VUF9xV55r7Bvn_zJp6tC3-KZKNLO0Rc2K-6JRgyyZjo7O_8aj7Ns6Lx0OjUXoKLiA6B79goHiv8qxJ04k5EWD_h8gt4M3_oByH_cVXH35RDK5SwNV6cVl6zRqiHUR9Ilivh6kfOLGqM2sXCKpXE78qRgHOBeOtl08JHFQO5oFkt1ob8iDqczX0nu-qwlcki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Sd9k",
| "header" : {
| "kid" : "did:peer:2.Ez6LSkGy3e2z54uP4U9HyXJXRpaF2ytsnTuVgh6SNNmCyGZQZ.Vz6Mkjdwvf9hWc6ibZndW9B97si92DSk9hWAhGYBgP9kUFk8Z.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHBzOi8vYm9iLmRpZC5mbWdwLmFwcC8iLCJhIjpbImRpZGNvbW0vdjIiXX19#key-1"
| }
| }
| ],
| "tag" : "uRH0gB3-fGvyqMulg9L9JbIVt4AIaeBJxRYhzuyhUlo",
| "iv" : "G8MpH-4mTlA3s59nBmnfkw"
|}""".stripMargin.fromJson[EncryptedMessage]

val encryptedMessageBob: Either[String, EncryptedMessage] =
"""{
| "ciphertext": "-dyjeU0aRQ8F87yAJFbOmmuon0UtEhQpmDQhYclMiTAqi06wH2bLTjtJNIOFG9sJ12uIyaQahPzCFBUyR2X22Oyl-1-Un0LOCAoRP584JuN19NdgKIytmSm4pg4VeSJ56SKO5D3Qe3G8XQa_7vO8O9-b_6V9mQXXZDkknNbphuiD7S53ss_VJzbgQVLRxkBrbnU1PL7yC6AhkAZNkUNCS8GGYbdEKFeRsdWjoROEnuQ1zzPN28eO3T4Wmt2APQ10vHum3Bl1RTiPRGCx3C-fSi05F-521jyP0rwyLeMZdBLruDz2IrUudtimFI3CKQ8_BcmuXTlLa1vw2hKlhk1_ppAmggW-qrjyZPiC9-XIN02OxZox5Xzba-cmg05Dj2zmEXryrxqFfyJlrV5FKSvWDfqeNAA9QNE0aUsgpKK9gOmu5pJRCuYNL96lbxdSCR4BiuX1G_ma2gagdIIY-70d22UPGcrZTw7Blet574i5U_bIDpZw4Az0UxoKNDbCDPOpn-Shojo5n_5FFbaPky0H0N99-9cx-Ns-3NMQecpupPQ9QJ-A2KWBTLYrJofLCBWv_ysqJ3Cde9fQ3xi5DTB13dhbxKVCgzdHKlwnqPC0C3mjFs_eZ1jnzBiUAKLvD_aWMwqx7y8GUhSfXlX3hImqtXaKBu2Koc1esU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wZDVNMlV5ZWpVMGRWQTBWVGxJZVZoS1dGSndZVVl5ZVhSemJsUjFWbWRvTmxOT1RtMURlVWRhVVZvIiwidHlwIjoiYXBwbGljYXRpb24vZGlkY29tbS1lbmNyeXB0ZWQranNvbiIsImVuYyI6IkEyNTZDQkMtSFM1MTIiLCJhbGciOiJFQ0RILTFQVStBMjU2S1cifQ",
| "recipients": [{
| "encrypted_key": "KCjv83os8FnpVaIUgcuYV-5TIw4VYuGIoHozQ0JVlIwK2sEkxwWg10yh0UlbbcnNVfF_OBr4OkJUczj7pB0spRhvjoDHBM_s",
| "header": {
| "kid": "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9hbGljZS5kaWQuZm1ncC5hcHAvIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ#6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y"
| }
| }],
| "tag": "iR0meUd8R3X5dleMywNHq5NaGJ4g0h2tok414SJ7UGI",
| "iv": "T-I0b4fIktFXVhAIFoSmQg"
|}""".stripMargin.fromJson[EncryptedMessage]
| "ciphertext" : "vnxtXHZRAeP3s4_vqTLyXphlqb4s_pWXs42WuqDalio62mE9gZNAO4HcYHDMYMaYs4bfAV0flwXl1rv32MIHIu2toE5EkvfR9josZYq4ocYVMx0NpGCmqyJURfScp-8oJKvYe9A7Si_P7F7yMHZuuJFxSfA0i5bSPs0GGRoK4Zc_u8WCDr3O9kvZJ7YVAt6kwobmdIncORolq_hMpXAwqlaOxkJ-irAdIAq_qbutEhk9EviDtYkCmD1z0JC9RIKx4qMwcDZrt-1dVSXqaIKt2K84jyW_--Qz_3Ifq2aeO_9Led-PRRYQUVzMMFn_6n9sOmWxqWt3BQDinNLPGu9v6CiHAL8CpemjQMbjfsocTUpHg5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hYMTkja2V5LTEiLCJhcHUiOiJaR2xrT25CbFpYSTZNaTVGZWpaTVUydEhlVE5sTW5vMU5IVlFORlU1U0hsWVNsaFNjR0ZHTW5sMGMyNVVkVlpuYURaVFRrNXRRM2xIV2xGYUxsWjZOazFyYW1SM2RtWTVhRmRqTm1saVdtNWtWemxDT1RkemFUa3lSRk5yT1doWFFXaEhXVUpuVURsclZVWnJPRm91VTJWNVNqQkphbTlwV2tjd2FVeERTbnBKYW5BM1NXNVdlV0ZUU1RaSmJXZ3daRWhDZWs5cE9IWlpiVGxwVEcxU2NGcEROVzFpVjJSM1RHMUdkMk5ET0dsTVEwcG9TV3B3WWtsdFVuQmFSMDUyWWxjd2RtUnFTV2xZV0RFNUkydGxlUzB4IiwidHlwIjoiYXBwbGljYXRpb24vZGlkY29tbS1lbmNyeXB0ZWQranNvbiIsImVuYyI6IkEyNTZDQkMtSFM1MTIiLCJhbGciOiJFQ0RILTFQVStBMjU2S1cifQ",
| "recipients" : [
| {
| "encrypted_key" : "CtMxsvs8c2WefiEqs83jTSVNekUhtbiddZTxRaMAc_wDgJ-ZmllZn63six7HvfkHQE25W8IyS-jCHdsaIa09xPqr4R7SzXCe",
| "header" : {
| "kid" : "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImEiOlsiZGlkY29tbS92MiJdfX0.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6IndzOi8vbG9jYWxob3N0OjgwODAvd3MiLCJhIjpbImRpZGNvbW0vdjIiXX19#key-1"
| }
| }
| ],
| "tag" : "PBWjww23CnAmuE-y-LxDMErye0mo5lO72Ox9d4vxzHA",
| "iv" : "5p68gZa0ZPaWDG7OCnI8nQ"
|}""".stripMargin.fromJson[EncryptedMessage]

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package io.iohk.atala.mediator.protocols

import fmgp.did.comm.{EncryptedMessage, PlaintextMessage}
import io.iohk.atala.mediator.db.UserAccountRepo
import io.iohk.atala.mediator.db.*
import reactivemongo.api.bson.BSONDocument
import zio.ZIO
import zio.json.*
import fmgp.did.comm
import reactivemongo.api.indexes.{Index, IndexType}
import fmgp.did.DIDSubject
trait MessageSetup {

trait MessageSetup extends DidAccountStubSetup {

val index = Index(
key = Seq("alias" -> IndexType.Ascending),
Expand All @@ -30,9 +31,7 @@ trait MessageSetup {
} yield {}
}

val mediatorDid = DIDSubject(
"did:peer:2.Ez6LSkGy3e2z54uP4U9HyXJXRpaF2ytsnTuVgh6SNNmCyGZQZ.Vz6Mkjdwvf9hWc6ibZndW9B97si92DSk9hWAhGYBgP9kUFk8Z.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9ib2IuZGlkLmZtZ3AuYXBwLyIsInIiOltdLCJhIjpbImRpZGNvbW0vdjIiXX0"
)
def mediatorDid = bob

val plaintextForwardNotEnrolledDidMessage: Either[String, PlaintextMessage] =
"""{
Expand Down Expand Up @@ -81,15 +80,15 @@ trait MessageSetup {
|}""".stripMargin.fromJson[PlaintextMessage]

val plaintextForwardEnrolledDidMessage: Either[String, PlaintextMessage] =
"""{
s"""{
| "id" : "5fbd421d-a2d6-458e-a232-396411b7a793",
| "type" : "https://didcomm.org/routing/2.0/forward",
| "to" : [
| "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ"
| "${alice}"
| ],
| "expires_time" : 987654321,
| "body" : {
| "next" : "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ"
| "next" : "${alice}"
| },
| "attachments" : [
| {
Expand Down

0 comments on commit 640546d

Please sign in to comment.