Skip to content

Commit

Permalink
Deprecate DID Peer's service.serviceEndpoint using old structure for #…
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioPinheiro committed Jan 5, 2024
1 parent 3de2117 commit 0b3d572
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ object DIDPeerExamples {
{
"id": "did:peer:2.Ez6LSbysY2xFMRpGMhb7tFTLMpeuPRaqaWM1yECx2AtzE3KCc.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.Vz6MkgoLTnTypo3tDRwCkZXSccTPHRLhF4ZnjhueYAFpEX6vg.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludCIsInIiOlsiZGlkOmV4YW1wbGU6c29tZW1lZGlhdG9yI3NvbWVrZXkiXSwiYSI6WyJkaWRjb21tL3YyIiwiZGlkY29tbS9haXAyO2Vudj1yZmM1ODciXX0#didcommmessaging-0",
"type": "DIDCommMessaging",
"serviceEndpoint": "https://example.com/endpoint",
"routingKeys": [
"did:example:somemediator#somekey"
],
"accept": [
"didcomm/v2", "didcomm/aip2;env=rfc587"
]
"serviceEndpoint": {
"uri":"https://example.com/endpoint",
"routingKeys": ["did:example:somemediator#somekey"],
"accept": ["didcomm/v2", "didcomm/aip2;env=rfc587"]
}
}
]
}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ class DIDPeerSuite extends ZSuite {
// ##############################################################################################
// New DIDPeerServiceEncoded -> because of https://github.com/Indicio-tech/didcomm-demo/issues/2

/** Old example of the DID Peer's services
*
* This example will eventually be removed. Since 'serviceEndpoint' is a string instead of object with 'uri',
* 'routingKeys' and 'accept' properties inside.
*/
@deprecated("serviceEndpoint with old structure")
val ex1Str =
"""[{"t":"dm","s":"https://did.fmgp.app","r":[],"a":["didcomm/v2"]},{"t":"dm","s":"ws://did.fmgp.app","r":[],"a":["didcomm/v2"]}]"""
val ex1AfterRemoveAbbreviation =
Expand Down Expand Up @@ -240,6 +246,7 @@ class DIDPeerSuite extends ZSuite {
|]""".stripMargin.replaceAll("\n", "").replaceAll(" ", "")

test("test DIDPeerServiceEncoded abbreviation ex1") {
@scala.annotation.nowarn("cat=deprecation")
val ret = DIDPeerServiceEncoded.abbreviation(ex1Str.fromJson[Json].getOrElse(???))
assertEquals(
ret.toJson,
Expand All @@ -256,6 +263,7 @@ class DIDPeerSuite extends ZSuite {
}

test("test DIDPeerServiceEncoded get services ex1") {
@scala.annotation.nowarn("cat=deprecation")
val service = DIDPeerServiceEncodedNew(Base64.encode(ex1Str))
.getDIDService(didSubject = DIDSubject("did:test:s1"), previouslyNumberOfService = 0)
assertEquals(service.size, 2)
Expand Down

0 comments on commit 0b3d572

Please sign in to comment.