File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ """Registry for DIDComm V2 Protocols."""
2+
3+ from typing import Coroutine , Dict , Sequence
4+
5+
6+ class V2ProtocolRegistry :
7+ """DIDComm V2 Protocols."""
8+
9+ def __init__ (self ):
10+ """Initialize a V2ProtocolRegistry instance."""
11+ self ._type_to_message_handler : Dict [str , Coroutine ] = {}
12+
13+ @property
14+ def protocols (self ) -> Sequence [str ]:
15+ """Accessor for a list of all message protocols."""
16+ return [str (key ) for key in self ._type_to_message_handler .keys ()]
17+
18+ def protocols_matching_query (self , query : str ) -> Sequence [str ]:
19+ """Return a list of message protocols matching a query string."""
20+ all_types = self .protocols
21+ result = None
22+
23+ if query == "*" or query is None :
24+ result = all_types
25+ elif query :
26+ if query .endswith ("*" ):
27+ match = query [:- 1 ]
28+ result = tuple (k for k in all_types if k .startswith (match ))
29+ elif query in all_types :
30+ result = (query ,)
31+ return result or ()
32+
33+ def register_handler (self , message_type : str , handler : Coroutine ):
34+ """Register a new message type to handler association."""
35+ self ._type_to_message_handler [message_type ] = handler
Original file line number Diff line number Diff line change 1+ """Handler for the trust ping protocol."""
2+
3+ from acapy_agent .transport .inbound .message import InboundMessage
4+
5+
6+ async def handle_trust_ping (message : InboundMessage ):
7+ """."""
8+ return False
You can’t perform that action at this time.
0 commit comments