-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support protocol discover-features 2.0 (#154)
* [WIP] feat: Support protocol discover-features 2.0 * add test * added test for non match * added test for non match --------- Co-authored-by: mineme0110 <[email protected]> Signed-off-by: Fabio Pinheiro <[email protected]> Signed-off-by: Shailesh Patil <[email protected]>
- Loading branch information
1 parent
f866daa
commit 0e93dca
Showing
8 changed files
with
261 additions
and
59 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
mediator/src/main/scala/io/iohk/atala/mediator/protocols/DiscoverFeaturesExecuter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package io.iohk.atala.mediator.protocols | ||
|
||
import fmgp.crypto.error.FailToParse | ||
import fmgp.did.Agent | ||
import fmgp.did.comm.{PIURI, PlaintextMessage} | ||
import fmgp.did.comm.protocol.discoverfeatures2._ | ||
import io.iohk.atala.mediator.{MediatorDidError, MediatorError} | ||
import io.iohk.atala.mediator.actions.{Action, NoReply, ProtocolExecuter, ProtocolExecuterWithServices, Reply} | ||
import zio.ZIO | ||
|
||
object DiscoverFeaturesExecuter extends ProtocolExecuterWithServices[ProtocolExecuter.Services, MediatorError] { | ||
|
||
override def supportedPIURI: Seq[PIURI] = Seq(FeatureQuery.piuri, FeatureDisclose.piuri) | ||
|
||
override def program[R1 <: Agent]( | ||
plaintextMessage: PlaintextMessage | ||
): ZIO[R1, MediatorError, Action] = { | ||
// the val is from the match to be definitely stable | ||
val piuriFeatureQuery = FeatureQuery.piuri | ||
val piuriFeatureDisclose = FeatureDisclose.piuri | ||
|
||
plaintextMessage.`type` match | ||
case `piuriFeatureQuery` => | ||
for { | ||
ret <- plaintextMessage.toFeatureQuery match | ||
case Left(error) => | ||
ZIO.logError(s"Fail in FeatureQuery: $error") *> | ||
ZIO.fail(MediatorDidError(FailToParse(error))) | ||
case Right(featureQuery) => | ||
for { | ||
_ <- ZIO.logInfo(featureQuery.toString()) | ||
agent <- ZIO.service[Agent] | ||
allProtocols = Seq( | ||
FeatureDisclose.Disclose( | ||
`feature-type` = "protocol", | ||
id = "https://didcomm.org/routing/2.0", | ||
roles = Some(Seq("mediator")), // sender | ||
), | ||
FeatureDisclose.Disclose( | ||
`feature-type` = "protocol", | ||
id = "https://didcomm.org/coordinate-mediation/2.0", | ||
roles = Some(Seq("responder")), // requester | ||
), | ||
FeatureDisclose.Disclose( | ||
`feature-type` = "protocol", | ||
id = "https://didcomm.org/messagepickup/3.0", | ||
roles = Some(Seq("mediator")), // recipient | ||
), | ||
FeatureDisclose.Disclose( | ||
`feature-type` = "protocol", | ||
id = "https://didcomm.org/trust-ping/2.0", | ||
roles = Some(Seq("receiver")), // sender | ||
), | ||
FeatureDisclose.Disclose( | ||
`feature-type` = "protocol", | ||
id = "https://didcomm.org/discover-features/2.0", | ||
roles = Some(Seq("responder")), // requester | ||
), | ||
) | ||
filter = featureQuery.queries | ||
.filter(q => q.`feature-type` == "protocol") | ||
.map(q => scala.util.matching.Regex(q.`match`)) | ||
discloses = filter.flatMap(reg => allProtocols.filter(e => reg.matches(e.id))).toSet | ||
} yield FeatureDisclose( | ||
thid = Some(featureQuery.id), | ||
to = Set(featureQuery.from.asTO), | ||
from = agent.id, | ||
disclosures = discloses.toSeq, | ||
) | ||
} yield Reply(ret.toPlaintextMessage) | ||
|
||
case `piuriFeatureDisclose` => | ||
for { | ||
_ <- plaintextMessage.toFeatureDisclose match | ||
case Left(error) => ZIO.fail(MediatorDidError(FailToParse(error))) | ||
case Right(featureDisclose) => ZIO.logInfo(featureDisclose.toString()) | ||
} yield NoReply | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 33 additions & 26 deletions
59
mediator/src/test/scala/io/iohk/atala/mediator/db/DidAccountStubSetup.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,44 @@ | ||
package io.iohk.atala.mediator.db | ||
import fmgp.did.DIDSubject | ||
import fmgp.did.comm.{EncryptedMessage, PlaintextMessage} | ||
import fmgp.did.method.peer.{DIDPeer2, DIDPeerServiceEncoded} | ||
//import io.iohk.atala.mediator.db.AgentStub.{keyAgreement, keyAuthentication} | ||
import zio.json.* | ||
trait DidAccountStubSetup { | ||
val alice = | ||
"did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ" | ||
DIDSubject( | ||
"did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ" | ||
) | ||
val bob = | ||
"did:peer:2.Ez6LSkGy3e2z54uP4U9HyXJXRpaF2ytsnTuVgh6SNNmCyGZQZ.Vz6Mkjdwvf9hWc6ibZndW9B97si92DSk9hWAhGYBgP9kUFk8Z.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9ib2IuZGlkLmZtZ3AuYXBwLyIsInIiOltdLCJhIjpbImRpZGNvbW0vdjIiXX0" | ||
DIDSubject( | ||
"did:peer:2.Ez6LSkGy3e2z54uP4U9HyXJXRpaF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1MTIiLCJhbGciOiJFQ0RILTFQVStBMjU2S1cifQ", | ||
| "recipients": [{ | ||
| "encrypted_key": "eFHcJkoUle7ZkksvZjvhJHLagF7y5B5gDQX11tc1kus2xa3Vn_QmzyVwFzScOHTCEjWRUe7r63rHBFBw0El2ukZW2tcitxr8", | ||
| "header": { | ||
| "kid": "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9hbGljZS5kaWQuZm1ncC5hcHAvIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ#6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y" | ||
| } | ||
| }], | ||
| "tag": "6MUE-lIZFVRId9qX-0If18EsPcfld_a3r2gQXXq4ms4", | ||
| "iv": "plEK7sqstAIkIxVKyfuuYg" | ||
|}""".stripMargin.fromJson[EncryptedMessage] | ||
val encryptedMessageBob: Either[String, EncryptedMessage] = """{ | ||
| "ciphertext": "-dyjeU0aRQ8F87yAJFbOmmuon0UtEhQpmDQhYclMiTAqi06wH2bLTjtJNIOFG9sJ12uIyaQahPzCFBUyR2X22Oyl-1-Un0LOCAoRP584JuN19NdgKIytmSm4pg4VeSJ56SKO5D3Qe3G8XQa_7vO8O9-b_6V9mQXXZDkknNbphuiD7S53ss_VJzbgQVLRxkBrbnU1PL7yC6AhkAZNkUNCS8GGYbdEKFeRsdWjoROEnuQ1zzPN28eO3T4Wmt2APQ10vHum3Bl1RTiPRGCx3C-fSi05F-521jyP0rwyLeMZdBLruDz2IrUudtimFI3CKQ8_BcmuXTlLa1vw2hKlhk1_ppAmggW-qrjyZPiC9-XIN02OxZox5Xzba-cmg05Dj2zmEXryrxqFfyJlrV5FKSvWDfqeNAA9QNE0aUsgpKK9gOmu5pJRCuYNL96lbxdSCR4BiuX1G_ma2gagd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6YVRreVJGTnJPV2hYUVdoSFdVSm5VRGxyVlVack9Gb3VVMlY1U2pCSmFtOXBXa2N3YVV4RFNucEphbTlwWVVoU01HTklUVFpNZVRscFlqSkpkVnBIYkd0TWJWcDBXak5CZFZsWVFuZE1lVWx6U1c1SmFVOXNkR1JNUTBwb1NXcHdZa2x0VW5CYVIwNTJZbGN3ZG1ScVNXbFlXREFqTmt4VGEwZDVNMlV5ZWpVMGRWQTBWVGxJZVZoS1dGSndZVVl5ZVhSemJsUjFWbWRvTmxOT1RtMURlVWRhVVZvIiwidHlwIjoiYXBwbGljYXRpb24vZGlkY29tbS1lbmNyeXB0ZWQranNvbiIsImVuYyI6IkEyNTZDQkMtSFM1MTIiLCJhbGciOiJFQ0RILTFQVStBMjU2S1cifQ", | ||
| "recipients": [{ | ||
| "encrypted_key": "KCjv83os8FnpVaIUgcuYV-5TIw4VYuGIoHozQ0JVlIwK2sEkxwWg10yh0UlbbcnNVfF_OBr4OkJUczj7pB0spRhvjoDHBM_s", | ||
| "header": { | ||
| "kid": "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9hbGljZS5kaWQuZm1ncC5hcHAvIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ#6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y" | ||
| } | ||
| }], | ||
| "tag": "iR0meUd8R3X5dleMywNHq5NaGJ4g0h2tok414SJ7UGI", | ||
| "iv": "T-I0b4fIktFXVhAIFoSmQg" | ||
|}""".stripMargin.fromJson[EncryptedMessage] | ||
val encryptedMessageAlice: Either[String, EncryptedMessage] = | ||
"""{ | ||
| "ciphertext": "L8wzawffzL7kbVyDcMiHgQMwlqLUqWDYOwH4f0VOFK7sJL8vO-H_JBDCADu7gvH1MDHdVJDX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ZG0iLCJzIjoiaHR0cHM6Ly9hbGljZS5kaWQuZm1ncC5hcHAvIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ#6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y" | ||
| } | ||
| }], | ||
| "tag": "6MUE-lIZFVRId9qX-0If18EsPcfld_a3r2gQXXq4ms4", | ||
| "iv": "plEK7sqstAIkIxVKyfuuYg" | ||
|}""".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_aWMwqx7y8GUhSfXlX3hImqtXaKBu2Koc1esUOvQwadHUj5pSmsNKJJcQLzsOcuYz8U9peRevrft3sy7fm9Ne2L3SSsoCFJP1N8U8bRLmyhY0CDuCNlvXxy_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iwidHlwIjoiYXBwbGljYXRpb24vZGlkY29tbS1lbmNyeXB0ZWQranNvbiIsImVuYyI6IkEyNTZDQkMtSFM1MTIiLCJhbGciOiJFQ0RILTFQVStBMjU2S1cifQ", | ||
| "recipients": [{ | ||
| "encrypted_key": "KCjv83os8FnpVaIUgcuYV-5TIw4VYuGIoHozQ0JVlIwK2sEkxwWg10yh0UlbbcnNVfF_OBr4OkJUczj7pB0spRhvjoDHBM_s", | ||
| "header": { | ||
| "kid": "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9hbGljZS5kaWQuZm1ncC5hcHAvIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ#6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y" | ||
| } | ||
| }], | ||
| "tag": "iR0meUd8R3X5dleMywNHq5NaGJ4g0h2tok414SJ7UGI", | ||
| "iv": "T-I0b4fIktFXVhAIFoSmQg" | ||
|}""".stripMargin.fromJson[EncryptedMessage] | ||
|
||
} |
Oops, something went wrong.