Skip to content

Commit a4748ea

Browse files
committed
feat: Add way to pull handler out of protocol registry
Signed-off-by: Colton Wolkins (Laptop) <[email protected]>
1 parent 9966e8b commit a4748ea

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

acapy_agent/core/dispatcher.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ async def make_v2_message(self, profile: Profile, parsed_msg: dict) -> BaseMessa
253253
raise MessageParseError(f"Unrecognized message type {message_type}")
254254

255255
try:
256-
instance = message_cls[0] #message_cls.deserialize(parsed_msg)
256+
#instance = message_cls[0] #message_cls.deserialize(parsed_msg)
257+
instance = registry.handlers[message_cls[0]]
258+
if isinstance(instance, DeferLoad):
259+
instance = message_cls.resolved
257260
except BaseModelError as e:
258261
if "/problem-report" in message_type:
259262
raise ProblemReportParseError("Error parsing problem report message")

acapy_agent/didcomm_v2/protocol_registry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ def __init__(self):
1010
"""Initialize a V2ProtocolRegistry instance."""
1111
self._type_to_message_handler: Dict[str, Coroutine] = {}
1212

13+
@property
14+
def handlers(self) -> Dict[str, Coroutine]:
15+
"""Accessor for a list of all message protocols."""
16+
return self._type_to_message_handler
17+
1318
@property
1419
def protocols(self) -> Sequence[str]:
1520
"""Accessor for a list of all message protocols."""

0 commit comments

Comments
 (0)