Skip to content

Commit

Permalink
feat: service builder accept attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
  • Loading branch information
dbluhm committed Aug 24, 2022
1 parent 7d45294 commit 078423b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pydid/doc/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ def add_didcomm(
self,
service_endpoint: str,
recipient_keys: List[VerificationMethod],
routing_keys: List[VerificationMethod] = None,
routing_keys: Optional[List[VerificationMethod]] = None,
*,
priority: int = None,
type_: str = None,
ident: Optional[str] = None
priority: Optional[int] = None,
type_: Optional[str] = None,
ident: Optional[str] = None,
accept: Optional[List[str]] = None
):
"""Add DIDComm Service."""
ident = ident or next(self._id_generator)
Expand All @@ -155,6 +156,7 @@ def add_didcomm(
routing_keys=[vmethod.id for vmethod in routing_keys],
type=type_,
priority=priority,
accept=accept,
)
self.services.append(service)
return service
Expand Down
15 changes: 15 additions & 0 deletions tests/doc/test_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ def test_programmatic_construction_didcomm():
route = builder.verification_method.add(
ExampleVerificationMethod, public_key_example="abcd"
)
builder.service.add_didcomm(
service_endpoint="https://example.com",
recipient_keys=[key],
routing_keys=[route],
accept=["didcomm/aip2;env=rfc19"],
)
builder.service.add_didcomm(
service_endpoint="https://example.com",
recipient_keys=[key],
Expand Down Expand Up @@ -449,6 +455,15 @@ def test_programmatic_construction_didcomm():
"recipientKeys": ["did:example:123#key-0"],
"routingKeys": ["did:example:123#key-1"],
"priority": 0,
"accept": ["didcomm/aip2;env=rfc19"],
},
{
"id": "did:example:123#service-1",
"type": "did-communication",
"serviceEndpoint": "https://example.com",
"recipientKeys": ["did:example:123#key-0"],
"routingKeys": ["did:example:123#key-1"],
"priority": 1,
}
],
}
Expand Down

0 comments on commit 078423b

Please sign in to comment.