aries_cloudagent.messaging package

Subpackages

Submodules

aries_cloudagent.messaging.agent_message module

aries_cloudagent.messaging.base_handler module

aries_cloudagent.messaging.base_message module

Base message.

class aries_cloudagent.messaging.base_message.BaseMessage[source]

Bases: abc.ABC

Abstract base class for messages.

This formally defines a “minimum viable message” and provides an unopinionated class for plugins to extend in whatever way makes sense in the context of the plugin.

abstract property Handler: Type[BaseHandler]

Return reference to handler class.

abstract classmethod deserialize(value: dict, msg_format: aries_cloudagent.messaging.base_message.DIDCommVersion = DIDCommVersion.v1)[source]

Return message object deserialized from value in format specified.

abstract serialize(msg_format: aries_cloudagent.messaging.base_message.DIDCommVersion = DIDCommVersion.v1) dict[source]

Return serialized message in format specified.

class aries_cloudagent.messaging.base_message.DIDCommVersion(value)[source]

Bases: enum.Enum

Serialized message formats.

v1 = 1
v2 = 2

aries_cloudagent.messaging.error module

Messaging-related error classes and codes.

exception aries_cloudagent.messaging.error.MessageParseError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Message parse error.

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

Bases: aries_cloudagent.core.error.BaseError

Message preparation error.

error_code = 'message_prepare_error'

aries_cloudagent.messaging.request_context module

aries_cloudagent.messaging.responder module

aries_cloudagent.messaging.util module

Utils for messages.

aries_cloudagent.messaging.util.canon(raw_attr_name: str) str[source]

Canonicalize input attribute name for indy proofs and credential offers.

Parameters

raw_attr_name – raw attribute name

Returns

canonicalized attribute name

aries_cloudagent.messaging.util.datetime_now() datetime.datetime[source]

Timestamp in UTC.

aries_cloudagent.messaging.util.datetime_to_str(dt: Union[str, datetime.datetime]) str[source]

Convert a datetime object to an indy-standard datetime string.

Parameters

dt – May be a string or datetime to allow automatic conversion

aries_cloudagent.messaging.util.encode(orig: Any) str[source]

Encode a credential value as an int.

Encode credential attribute value, purely stringifying any int32 and leaving numeric int32 strings alone, but mapping any other input to a stringified 256-bit (but not 32-bit) integer. Predicates in indy-sdk operate on int32 values properly only when their encoded values match their raw values.

Parameters

orig – original value to encode

Returns

encoded value

aries_cloudagent.messaging.util.epoch_to_str(epoch: int) str[source]

Convert epoch seconds to indy-standard datetime string.

Parameters

epoch – epoch seconds

aries_cloudagent.messaging.util.str_to_datetime(dt: Union[str, datetime.datetime]) datetime.datetime[source]

Convert an indy-standard datetime string to a datetime.

Using a fairly lax regex pattern to match slightly different formats. In Python 3.7 datetime.fromisoformat might be used.

Parameters

dt – May be a string or datetime to allow automatic conversion

aries_cloudagent.messaging.util.str_to_epoch(dt: Union[str, datetime.datetime]) int[source]

Convert an indy-standard datetime string to epoch seconds.

Parameters

dt – May be a string or datetime to allow automatic conversion

aries_cloudagent.messaging.util.time_now() str[source]

Timestamp in ISO format.

aries_cloudagent.messaging.valid module