aries_cloudagent.transport.inbound package¶
Submodules¶
aries_cloudagent.transport.inbound.base module¶
Base inbound transport class.
-
class
aries_cloudagent.transport.inbound.base.
BaseInboundTransport
(scheme: str, create_session: Callable, *, max_message_size: int = 0, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None)[source]¶ Bases:
abc.ABC
Base inbound transport class.
-
create_session
(*, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None) → Awaitable[aries_cloudagent.transport.inbound.session.InboundSession][source]¶ Create a new inbound session.
Parameters: - accept_undelivered – Flag for accepting undelivered messages
- can_respond – Flag indicating that the transport can send responses
- client_info – Request-specific client information
- wire_format – Optionally override the session wire format
-
max_message_size
¶ Accessor for this transport’s max message size.
-
scheme
¶ Accessor for this transport’s scheme.
-
-
class
aries_cloudagent.transport.inbound.base.
InboundTransportConfiguration
(module, host, port)¶ Bases:
tuple
-
host
¶ Alias for field number 1
-
module
¶ Alias for field number 0
-
port
¶ Alias for field number 2
-
-
exception
aries_cloudagent.transport.inbound.base.
InboundTransportError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.error.TransportError
Generic inbound transport error.
-
exception
aries_cloudagent.transport.inbound.base.
InboundTransportRegistrationError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.InboundTransportError
Error in loading an inbound transport.
-
exception
aries_cloudagent.transport.inbound.base.
InboundTransportSetupError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.InboundTransportError
Setup error for an inbound transport.
aries_cloudagent.transport.inbound.delivery_queue module¶
The Delivery Queue.
The delivery queue holds and manages messages that have not yet been delivered to their intended destination.
-
class
aries_cloudagent.transport.inbound.delivery_queue.
DeliveryQueue
[source]¶ Bases:
object
DeliveryQueue class.
Manages undelivered messages.
-
add_message
(msg: aries_cloudagent.transport.outbound.message.OutboundMessage)[source]¶ Add an OutboundMessage to delivery queue.
The message is added once per recipient key
Parameters: msg – The OutboundMessage to add
-
expire_messages
(ttl=None)[source]¶ Expire messages that are past the time limit.
Parameters: ttl – Optional. Allows override of configured ttl
-
get_one_message_for_key
(key: str)[source]¶ Remove and return a matching message.
Parameters: key – The key to use for lookup
-
has_message_for_key
(key: str)[source]¶ Check for queued messages by key.
Parameters: key – The key to use for lookup
-
inspect_all_messages_for_key
(key: str)[source]¶ Return all messages for key.
Parameters: key – The key to use for lookup
-
aries_cloudagent.transport.inbound.http module¶
Http Transport classes and functions.
-
class
aries_cloudagent.transport.inbound.http.
HttpTransport
(host: str, port: int, create_session, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.BaseInboundTransport
Http Transport class.
-
inbound_message_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb053c51650>)[source]¶ Message handler for inbound messages.
Parameters: request – aiohttp request object Returns: The web response
-
invite_message_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb053c51650>)[source]¶ Message handler for invites.
Parameters: request – aiohttp request object Returns: The web response
-
make_application
() → <sphinx.ext.autodoc.importer._MockObject object at 0x7fb053c51650>[source]¶ Construct the aiohttp application.
-
aries_cloudagent.transport.inbound.manager module¶
Inbound transport manager.
-
class
aries_cloudagent.transport.inbound.manager.
InboundTransportManager
(profile: aries_cloudagent.core.profile.Profile, receive_inbound: Coroutine[T_co, T_contra, V_co], return_inbound: Callable = None)[source]¶ Bases:
object
Inbound transport manager class.
-
closed_session
(session: aries_cloudagent.transport.inbound.session.InboundSession)[source]¶ Clean up a closed session.
Returns an undelivered message to the caller if possible.
-
create_session
(transport_type: str, *, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None)[source]¶ Create a new inbound session.
Parameters: - transport_type – The inbound transport identifier
- accept_undelivered – Flag for accepting undelivered messages
- can_respond – Flag indicating that the transport can send responses
- client_info – An optional dict describing the client
- wire_format – Override the wire format for this session
-
dispatch_complete
(message: aries_cloudagent.transport.inbound.message.InboundMessage, completed: aries_cloudagent.utils.task_queue.CompletedTask)[source]¶ Handle completion of message dispatch.
-
get_transport_instance
(transport_id: str) → aries_cloudagent.transport.inbound.base.BaseInboundTransport[source]¶ Get an instance of a running transport by ID.
-
process_undelivered
(session: aries_cloudagent.transport.inbound.session.InboundSession)[source]¶ Interact with undelivered queue to find applicable messages.
Parameters: session – The inbound session
-
register
(config: aries_cloudagent.transport.inbound.base.InboundTransportConfiguration) → str[source]¶ Register transport module.
Parameters: config – The inbound transport configuration
-
register_transport
(transport: aries_cloudagent.transport.inbound.base.BaseInboundTransport, transport_id: str) → str[source]¶ Register a new inbound transport class.
Parameters: - transport – Transport instance to register
- transport_id – The transport ID to register
-
return_to_session
(outbound: aries_cloudagent.transport.outbound.message.OutboundMessage) → bool[source]¶ Return an outbound message via an open session, if possible.
-
return_undelivered
(outbound: aries_cloudagent.transport.outbound.message.OutboundMessage) → bool[source]¶ Add an undelivered message to the undelivered queue.
At this point the message could not be associated with an inbound session and could not be delivered via an outbound transport.
-
aries_cloudagent.transport.inbound.message module¶
Classes representing inbound messages.
-
class
aries_cloudagent.transport.inbound.message.
InboundMessage
(payload: Union[str, bytes], receipt: aries_cloudagent.transport.inbound.receipt.MessageReceipt, *, connection_id: str = None, session_id: str = None, transport_type: str = None)[source]¶ Bases:
object
Container class linking a message payload with its receipt details.
aries_cloudagent.transport.inbound.receipt module¶
Classes for representing message receipt details.
-
class
aries_cloudagent.transport.inbound.receipt.
MessageReceipt
(*, connection_id: str = None, direct_response_mode: str = None, in_time: datetime.datetime = None, raw_message: str = None, recipient_verkey: str = None, recipient_did: str = None, recipient_did_public: bool = None, sender_did: str = None, sender_verkey: str = None, thread_id: str = None)[source]¶ Bases:
object
Properties of an agent message’s delivery.
-
REPLY_MODE_ALL
= 'all'¶
-
REPLY_MODE_NONE
= 'none'¶
-
REPLY_MODE_THREAD
= 'thread'¶
-
connection_id
¶ Accessor for the pairwise connection identifier.
Returns: This context’s connection identifier
-
direct_response_mode
¶ Accessor for the requested direct response mode.
Returns: This context’s requested direct response mode
-
direct_response_requested
¶ Accessor for the the state of the direct response mode.
Returns: This context’s requested direct response mode
-
in_time
¶ Accessor for the datetime the message was received.
Returns: This context’s received time
-
raw_message
¶ Accessor for the raw message text.
Returns: The raw message text
-
recipient_did
¶ Accessor for the recipient DID which corresponds with the verkey.
Returns: The recipient DID
-
recipient_did_public
¶ Check if the recipient did is public.
Indicates whether the message is associated with a public (ledger) recipient DID.
Returns: True if the recipient’s DID is public, else false
-
recipient_verkey
¶ Accessor for the recipient verkey key used to pack the incoming request.
Returns: The recipient verkey
-
sender_did
¶ Accessor for the sender DID which corresponds with the verkey.
Returns: The sender did
-
sender_verkey
¶ Accessor for the sender public key used to pack the incoming request.
Returns: This context’s sender’s verkey
-
thread_id
¶ Accessor for the identifier of the message thread.
Returns: The delivery thread ID
-
aries_cloudagent.transport.inbound.session module¶
Inbound connection handling classes.
-
class
aries_cloudagent.transport.inbound.session.
AcceptResult
(accepted: bool, retry: bool = False)[source]¶ Bases:
object
Represent the result of accept_response.
-
class
aries_cloudagent.transport.inbound.session.
InboundSession
(*, profile: aries_cloudagent.core.profile.Profile, inbound_handler: Callable, session_id: str, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, close_handler: Callable = None, reply_mode: str = None, reply_thread_ids: Sequence[str] = None, reply_verkeys: Sequence[str] = None, transport_type: str = None)[source]¶ Bases:
object
Track an open transport connection for direct routing of outbound messages.
-
accept_response
(message: aries_cloudagent.transport.outbound.message.OutboundMessage) → aries_cloudagent.transport.inbound.session.AcceptResult[source]¶ Try to queue an outbound message if it applies to this session.
Returns: a tuple of (message buffered, retry later)
-
can_respond
¶ Accessor for the session can-respond state.
-
closed
¶ Accessor for the session closed state.
-
encode_outbound
(outbound: aries_cloudagent.transport.outbound.message.OutboundMessage) → aries_cloudagent.transport.outbound.message.OutboundMessage[source]¶ Apply wire formatting to an outbound message.
-
handle_relay_context
(payload_enc: Union[str, bytes])[source]¶ Update the session profile based on the recipients of an incoming message.
-
parse_inbound
(payload_enc: Union[str, bytes]) → aries_cloudagent.transport.inbound.message.InboundMessage[source]¶ Convert a message payload and to an inbound message.
-
process_inbound
(message: aries_cloudagent.transport.inbound.message.InboundMessage)[source]¶ Process an incoming message and update the session metadata as necessary.
Parameters: message – The inbound message instance
-
receive
(payload_enc: Union[str, bytes]) → aries_cloudagent.transport.inbound.message.InboundMessage[source]¶ Receive a new message payload and dispatch the message.
-
receive_inbound
(message: aries_cloudagent.transport.inbound.message.InboundMessage)[source]¶ Deliver the inbound message to the conductor.
-
reply_mode
¶ Accessor for the session reply mode.
-
reply_thread_ids
¶ Accessor for the reply thread IDs.
-
reply_verkeys
¶ Accessor for the reply verkeys.
-
response_buffered
¶ Check if a response is currently buffered.
-
select_outbound
(message: aries_cloudagent.transport.outbound.message.OutboundMessage) → bool[source]¶ Determine if an outbound message should be sent to this session.
Parameters: message – The outbound message to be checked
-
aries_cloudagent.transport.inbound.ws module¶
Websockets Transport classes and functions.
-
class
aries_cloudagent.transport.inbound.ws.
WsTransport
(host: str, port: int, create_session, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.BaseInboundTransport
Websockets Transport class.
-
inbound_message_handler
(request)[source]¶ Message handler for inbound messages.
Parameters: request – aiohttp request object Returns: The web response
-
make_application
() → <sphinx.ext.autodoc.importer._MockObject object at 0x7fb053e5c1d0>[source]¶ Construct the aiohttp application.
-
scheme
¶ Accessor for this transport’s scheme.
-