aries_cloudagent.transport package

Submodules

aries_cloudagent.transport.error module

Transport-related error classes and codes.

exception aries_cloudagent.transport.error.MessageEncodeError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.transport.error.WireFormatError

Message encoding error.

error_code = 'message_encode_error'
exception aries_cloudagent.transport.error.MessageParseError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.transport.error.WireFormatError

Message parse error.

error_code = 'message_parse_error'
exception aries_cloudagent.transport.error.TransportError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Base class for all transport errors.

exception aries_cloudagent.transport.error.WireFormatError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.transport.error.TransportError

Base class for wire-format errors.

aries_cloudagent.transport.pack_format module

Standard packed message format classes.

class aries_cloudagent.transport.pack_format.PackWireFormat[source]

Bases: aries_cloudagent.transport.wire_format.BaseWireFormat

Standard DIDComm message parser and serializer.

encode_message(context: aries_cloudagent.config.injection_context.InjectionContext, message_json: Union[str, bytes], recipient_keys: Sequence[str], routing_keys: Sequence[str], sender_key: str) → Union[str, bytes][source]

Encode an outgoing message for transport.

Parameters:
  • context – The injection context for settings and services
  • message_json – The message body to serialize
  • recipient_keys – A sequence of recipient verkeys
  • routing_keys – A sequence of routing verkeys
  • sender_key – The verification key of the sending agent
Returns:

The encoded message

Raises:

MessageEncodeError – If the message could not be encoded

pack(context: aries_cloudagent.config.injection_context.InjectionContext, message_json: Union[str, bytes], recipient_keys: Sequence[str], routing_keys: Sequence[str], sender_key: str)[source]

Look up the wallet instance and perform the message pack.

parse_message(context: aries_cloudagent.config.injection_context.InjectionContext, message_body: Union[str, bytes]) → Tuple[dict, aries_cloudagent.transport.inbound.receipt.MessageReceipt][source]

Deserialize an incoming message and further populate the request context.

Parameters:
  • context – The injection context for settings and services
  • message_body – The body of the message
Returns:

A tuple of the parsed message and a message receipt instance

Raises:
  • MessageParseError – If the JSON parsing failed
  • MessageParseError – If a wallet is required but can’t be located
unpack(context: aries_cloudagent.config.injection_context.InjectionContext, message_body: Union[str, bytes], receipt: aries_cloudagent.transport.inbound.receipt.MessageReceipt)[source]

Look up the wallet instance and perform the message unpack.

aries_cloudagent.transport.stats module

aiohttp stats collector support.

class aries_cloudagent.transport.stats.StatsTracer(collector: aries_cloudagent.utils.stats.Collector, prefix: str)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Attach hooks to client session events and report statistics.

connection_queued_end(session, context, params)[source]

Handle the end of a queued connection.

connection_queued_start(session, context, params)[source]

Handle the start of a queued connection.

connection_ready(session, context, params)[source]

Handle the end of connection acquisition.

dns_resolvehost_end(session, context, params)[source]

Handle the end of a DNS resolution.

dns_resolvehost_start(session, context, params)[source]

Handle the start of a DNS resolution.

request_end(session, context, params)[source]

Handle the end of request.

request_start(session, context, params)[source]

Handle the start of a request.

socket_connect_start(session, context, params)[source]

Handle the start of a socket connection.

aries_cloudagent.transport.wire_format module

Abstract wire format classes.

class aries_cloudagent.transport.wire_format.BaseWireFormat[source]

Bases: object

Abstract messaging wire format.

encode_message(context: aries_cloudagent.config.injection_context.InjectionContext, message_json: Union[str, bytes], recipient_keys: Sequence[str], routing_keys: Sequence[str], sender_key: str) → Union[str, bytes][source]

Encode an outgoing message for transport.

Parameters:
  • context – The injection context for settings and services
  • message_json – The message body to serialize
  • recipient_keys – A sequence of recipient verkeys
  • routing_keys – A sequence of routing verkeys
  • sender_key – The verification key of the sending agent
Returns:

The encoded message

Raises:

MessageEncodeError – If the message could not be encoded

parse_message(context: aries_cloudagent.config.injection_context.InjectionContext, message_body: Union[str, bytes]) → Tuple[dict, aries_cloudagent.transport.inbound.receipt.MessageReceipt][source]

Deserialize an incoming message and further populate the request context.

Parameters:
  • context – The injection context for settings and services
  • message_body – The body of the message
Returns:

A tuple of the parsed message and a message receipt instance

Raises:

MessageParseError – If the message can’t be parsed

class aries_cloudagent.transport.wire_format.JsonWireFormat[source]

Bases: aries_cloudagent.transport.wire_format.BaseWireFormat

Unencrypted wire format.

encode_message(context: aries_cloudagent.config.injection_context.InjectionContext, message_json: Union[str, bytes], recipient_keys: Sequence[str], routing_keys: Sequence[str], sender_key: str) → Union[str, bytes][source]

Encode an outgoing message for transport.

Parameters:
  • context – The injection context for settings and services
  • message_json – The message body to serialize
  • recipient_keys – A sequence of recipient verkeys
  • routing_keys – A sequence of routing verkeys
  • sender_key – The verification key of the sending agent
Returns:

The encoded message

Raises:

MessageEncodeError – If the message could not be encoded

parse_message(context: aries_cloudagent.config.injection_context.InjectionContext, message_body: Union[str, bytes]) → Tuple[dict, aries_cloudagent.transport.inbound.receipt.MessageReceipt][source]

Deserialize an incoming message and further populate the request context.

Parameters:
  • context – The injection context for settings and services
  • message_body – The body of the message
Returns:

A tuple of the parsed message and a message receipt instance

Raises:

MessageParseError – If the JSON parsing failed