Skip to content

Commit 92c63b2

Browse files
committed
fix: align with DIDComm v2.1 spec for service endpoints
Signed-off-by: Daniel Bluhm <[email protected]>
1 parent c790b7c commit 92c63b2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

pydid/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Config:
6363
extra = Extra.forbid
6464

6565
type: Literal["DIDCommMessaging"] = "DIDCommMessaging"
66-
service_endpoint: List[DIDCommV2ServiceEndpoint]
66+
service_endpoint: Union[List[DIDCommV2ServiceEndpoint], DIDCommV2ServiceEndpoint]
6767

6868

6969
class UnknownService(Service):

tests/test_service.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@
5454
}
5555
],
5656
},
57+
{
58+
"id": "did:example:123456789abcdefghi#didcomm-1",
59+
"type": "DIDCommMessaging",
60+
"serviceEndpoint": {
61+
"uri": "https://example.com/path",
62+
"accept": ["didcomm/v2", "didcomm/aip2;env=rfc587"],
63+
"routingKeys": ["did:example:somemediator#somekey"],
64+
},
65+
},
5766
]
5867

5968
INVALID_SERVICES = [
@@ -172,6 +181,15 @@ def test_serialization(service_raw):
172181
}
173182
],
174183
},
184+
{
185+
"id": "did:example:123456789abcdefghi#didcomm-1",
186+
"type": "DIDCommMessaging",
187+
"serviceEndpoint": {
188+
"uri": "https://example.com/path",
189+
"accept": ["didcomm/v2", "didcomm/aip2;env=rfc587"],
190+
"routingKeys": ["did:example:somemediator#somekey"],
191+
},
192+
},
175193
]
176194

177195
DIDCOMM_INVALID_SERVICES = [

0 commit comments

Comments
 (0)